diff --git a/httprunner/cli.py b/httprunner/cli.py index 677f7be8..0e65ea4a 100644 --- a/httprunner/cli.py +++ b/httprunner/cli.py @@ -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") diff --git a/main-debug.py b/main-debug.py deleted file mode 100644 index 04fd39b1..00000000 --- a/main-debug.py +++ /dev/null @@ -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")