feat: 添加用于覆盖率测试的退出代码

This commit is contained in:
RockChinQ 2023-11-26 17:42:25 +08:00
parent 7708eaa82c
commit 419354cb07

View File

@ -463,12 +463,19 @@ def main():
except: except:
stop() stop()
pkg.utils.context.get_thread_ctl().shutdown() pkg.utils.context.get_thread_ctl().shutdown()
launch_args = sys.argv.copy()
if "--cov-report" not in launch_args:
import platform import platform
if platform.system() == 'Windows': if platform.system() == 'Windows':
cmd = "taskkill /F /PID {}".format(os.getpid()) cmd = "taskkill /F /PID {}".format(os.getpid())
elif platform.system() in ['Linux', 'Darwin']: elif platform.system() in ['Linux', 'Darwin']:
cmd = "kill -9 {}".format(os.getpid()) cmd = "kill -9 {}".format(os.getpid())
os.system(cmd) os.system(cmd)
else:
print("正常退出以生成覆盖率报告")
sys.exit(0)
if __name__ == '__main__': if __name__ == '__main__':