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