check conflict parameter args: --full-speed --no-web

This commit is contained in:
debugtalk
2017-12-13 14:17:55 +08:00
parent 3f3b0f1ea7
commit 9e6ba32648

View File

@@ -103,7 +103,7 @@ def main_locust():
except ImportError: except ImportError:
msg = "Locust is not installed, install first and try again.\n" msg = "Locust is not installed, install first and try again.\n"
msg += "install command: pip install locustio" msg += "install command: pip install locustio"
print(msg) logging.info(msg)
exit(1) exit(1)
sys.argv[0] = 'locust' sys.argv[0] = 'locust'
@@ -118,13 +118,18 @@ def main_locust():
testcase_index = sys.argv.index('-f') + 1 testcase_index = sys.argv.index('-f') + 1
assert testcase_index < len(sys.argv) assert testcase_index < len(sys.argv)
except (ValueError, AssertionError): except (ValueError, AssertionError):
print("Testcase file is not specified, exit.") logging.error("Testcase file is not specified, exit.")
sys.exit(1) sys.exit(1)
testcase_file_path = sys.argv[testcase_index] testcase_file_path = sys.argv[testcase_index]
sys.argv[testcase_index] = locusts.parse_locustfile(testcase_file_path) sys.argv[testcase_index] = locusts.parse_locustfile(testcase_file_path)
if "--full-speed" in sys.argv: if "--full-speed" in sys.argv:
if "--no-web" in sys.argv:
logging.warning("conflict parameter args: --full-speed --no-web. \nexit.")
sys.exit(1)
locusts.run_locusts_at_full_speed(sys.argv) locusts.run_locusts_at_full_speed(sys.argv)
else: else:
locusts.main() locusts.main()