diff --git a/CHANGELOG.md b/CHANGELOG.md index 44880cb3..de5ccef3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ **Fixed** - fix #658: sys.exit 1 if any testcase failed +- fix ModuleNotFoundError in debugging mode if httprunner uninstalled ## 2.2.4 (2019-07-18) diff --git a/httprunner/cli.py b/httprunner/cli.py index 02cb4c13..03e0c336 100644 --- a/httprunner/cli.py +++ b/httprunner/cli.py @@ -186,9 +186,12 @@ if __name__ == "__main__": """ debugging mode """ import sys + import os + if len(sys.argv) == 0: exit(0) + sys.path.insert(0, os.getcwd()) cmd = sys.argv.pop(1) if cmd in ["hrun", "httprunner", "ate"]: @@ -200,7 +203,7 @@ if __name__ == "__main__": 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" + "python -m httprunner.cli hrun /path/to/testcase_file", + "python -m httprunner.cli locusts -f /path/to/testcase_file" ]) color_print(example, "yellow")