From 78acd7dc463d3c462dfc6413b4f25cdafe59b464 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 12 Dec 2019 13:16:27 +0800 Subject: [PATCH] fix: check if locustio installed --- docs/CHANGELOG.md | 3 ++- httprunner/plugins/locusts/cli.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4534b415..00ac1fe1 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 2.4.1 (2019-12-11) +## 2.4.1 (2019-12-12) **Added** @@ -10,6 +10,7 @@ **Fixed** - fix: typo testfile_paths +- fix: check if locustio installed ## 2.4.0 (2019-12-11) diff --git a/httprunner/plugins/locusts/cli.py b/httprunner/plugins/locusts/cli.py index 882719e0..364ab22f 100644 --- a/httprunner/plugins/locusts/cli.py +++ b/httprunner/plugins/locusts/cli.py @@ -2,6 +2,7 @@ try: # monkey patch ssl at beginning to avoid RecursionError when running locust. from gevent import monkey monkey.patch_ssl() + from locust import main as locust_main except ImportError: msg = """ Locust is not installed, install first and try again. @@ -61,8 +62,7 @@ def gen_locustfile(testcase_file_path): def start_locust_main(): - from locust.main import main - main() + locust_main.main() def start_master(sys_argv):