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

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

19
main.py
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()
import platform
if platform.system() == 'Windows': launch_args = sys.argv.copy()
cmd = "taskkill /F /PID {}".format(os.getpid())
elif platform.system() in ['Linux', 'Darwin']: if "--cov-report" not in launch_args:
cmd = "kill -9 {}".format(os.getpid()) import platform
os.system(cmd) if platform.system() == 'Windows':
cmd = "taskkill /F /PID {}".format(os.getpid())
elif platform.system() in ['Linux', 'Darwin']:
cmd = "kill -9 {}".format(os.getpid())
os.system(cmd)
else:
print("正常退出以生成覆盖率报告")
sys.exit(0)
if __name__ == '__main__': if __name__ == '__main__':