improvement: relocate debugging scripts

This commit is contained in:
debugtalk
2019-07-18 17:36:50 +08:00
parent 3023051a15
commit d0453cf468
2 changed files with 24 additions and 19 deletions

View File

@@ -176,3 +176,27 @@ def main_locust():
locusts.run_locusts_with_processes(sys.argv, processes_count)
else:
locusts.start_locust_main()
if __name__ == "__main__":
""" debugging mode
"""
import sys
if len(sys.argv) == 0:
exit(0)
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 main-debug.py hrun /path/to/testcase_file",
"python main-debug.py locusts -f /path/to/testcase_file"
])
color_print(example, "yellow")

View File

@@ -1,19 +0,0 @@
import sys
from httprunner.cli import main_hrun, main_locust
from httprunner.logger import color_print
cmd = sys.argv.pop(1)
if cmd in ["hrun", "httprunner", "ate"]:
main_hrun()
elif cmd in ["locust", "locusts"]:
main_locust()
else:
color_print("Miss debugging type.", "RED")
example = "\n".join([
"e.g.",
"python main-debug.py hrun /path/to/testcase_file",
"python main-debug.py locusts -f /path/to/testcase_file"
])
color_print(example, "yellow")