change: split locust main from httprunner cli

This commit is contained in:
debugtalk
2019-10-25 15:44:49 +08:00
parent 705bade1a0
commit 890f2796c0
4 changed files with 121 additions and 138 deletions
+2 -23
View File
@@ -1,27 +1,6 @@
import os
import sys
from httprunner.cli import main_hrun, main_locust
from httprunner.cli import main
if __name__ == "__main__":
""" debugging mode
"""
if len(sys.argv) == 0:
sys.exit(1)
sys.path.insert(0, os.getcwd())
cmd = sys.argv.pop(1)
if cmd in ["hrun", "httprunner", "ate"]:
main_hrun()
elif cmd in ["locust", "locusts"]:
main_locust()
else:
from httprunner.logger import color_print
color_print("Miss debugging type.", "RED")
example = "\n".join([
"e.g.",
"python -m httprunner hrun /path/to/testcase_file",
"python -m httprunner locusts -f /path/to/testcase_file"
])
color_print(example, "yellow")
sys.exit(main())