mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 06:19:44 +08:00
change: use sys.exit(code) in hrun main
This commit is contained in:
@@ -12,6 +12,10 @@
|
||||
- fix: display request & response details in report when extraction failed
|
||||
- fix: include CHANGELOG in package
|
||||
|
||||
**Changed**
|
||||
|
||||
- change: use sys.exit(code) in hrun main
|
||||
|
||||
## 2.4.7 (2019-12-24)
|
||||
|
||||
**Added**
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import sys
|
||||
from httprunner.cli import main
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
main()
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
from sentry_sdk import capture_exception
|
||||
|
||||
from httprunner import __description__, __version__
|
||||
from httprunner.api import HttpRunner
|
||||
from httprunner.compat import is_py2
|
||||
@@ -64,23 +66,23 @@ def main():
|
||||
if len(sys.argv) == 1:
|
||||
# no argument passed
|
||||
parser.print_help()
|
||||
return 0
|
||||
sys.exit(0)
|
||||
|
||||
if args.version:
|
||||
color_print("{}".format(__version__), "GREEN")
|
||||
return 0
|
||||
sys.exit(0)
|
||||
|
||||
if args.validate:
|
||||
validate_json_file(args.validate)
|
||||
return 0
|
||||
sys.exit(0)
|
||||
if args.prettify:
|
||||
prettify_json_file(args.prettify)
|
||||
return 0
|
||||
sys.exit(0)
|
||||
|
||||
project_name = args.startproject
|
||||
if project_name:
|
||||
create_scaffold(project_name)
|
||||
return 0
|
||||
sys.exit(0)
|
||||
|
||||
runner = HttpRunner(
|
||||
failfast=args.failfast,
|
||||
@@ -104,10 +106,10 @@ def main():
|
||||
except Exception as ex:
|
||||
color_print("!!!!!!!!!! exception stage: {} !!!!!!!!!!".format(runner.exception_stage), "YELLOW")
|
||||
capture_exception(ex)
|
||||
raise
|
||||
err_code = 1
|
||||
|
||||
return err_code
|
||||
sys.exit(err_code)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user