fix ModuleNotFoundError in debugging mode if httprunner uninstalled

This commit is contained in:
debugtalk
2019-07-28 14:30:31 +08:00
parent bf6d4b63b5
commit a2ca6c415b
2 changed files with 6 additions and 2 deletions

View File

@@ -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)

View File

@@ -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")