diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9b020f0cb7..621c291319 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,6 +40,7 @@ jobs: - name: Install Poetry uses: snok/install-poetry@v1 with: + version: 1.8.5 virtualenvs-create: true virtualenvs-in-project: true virtualenvs-path: .venv @@ -165,6 +166,7 @@ jobs: - name: Install Poetry uses: snok/install-poetry@v1 with: + version: 1.8.5 virtualenvs-create: true virtualenvs-in-project: true virtualenvs-path: .venv diff --git a/docs/developing-locust.rst b/docs/developing-locust.rst index dcd553cb5c..59c26faca4 100644 --- a/docs/developing-locust.rst +++ b/docs/developing-locust.rst @@ -16,7 +16,7 @@ Fork Locust on `GitHub `_ and then # clone the repo: $ git clone git://github.com//locust.git - # install the poetry build system, see https://python-poetry.org/docs/#installation + # install the poetry build system, version 1.8.5, see https://python-poetry.org/docs/#installation # install the required poetry plugins: $ poetry self add "poethepoet[poetry_plugin]" diff --git a/locust/test/__init__.py b/locust/test/__init__.py index f572fea02c..b8fc66aef5 100644 --- a/locust/test/__init__.py +++ b/locust/test/__init__.py @@ -13,3 +13,10 @@ changed_rlimit = True except Exception: changed_rlimit = False + +import os + +# Clean environment from stuff you might have lying around +os.environ.pop("LOCUST_WEB_LOGIN", None) +# Ensure locust-cloud is not loaded during tests +os.environ.pop("PGHOST", None) diff --git a/locust/test/test_main.py b/locust/test/test_main.py index 4ed88b8e2b..63d71f7c63 100644 --- a/locust/test/test_main.py +++ b/locust/test/test_main.py @@ -613,7 +613,6 @@ def test_autostart_wo_run_time(self): response = requests.get(f"http://localhost:{port}/") except Exception: pass - self.assertEqual(200, response.status_code) proc.send_signal(signal.SIGTERM) stdout, stderr = proc.communicate() self.assertIn("Starting Locust", stderr) @@ -621,6 +620,7 @@ def test_autostart_wo_run_time(self): self.assertIn("Shutting down ", stderr) self.assertNotIn("Traceback", stderr) # check response afterwards, because it really isn't as informative as stderr + self.assertEqual(200, response.status_code) d = pq(response.content.decode("utf-8")) self.assertEqual(200, response.status_code) @@ -885,7 +885,7 @@ def t(self): mocked.file_path, "--headless", "--run-time", - "7s", + "6s", "-u", "0", "--loglevel", @@ -999,7 +999,7 @@ def test_spawing_with_fixed_multiple_locustfiles(self): f"{mocked1.file_path},{mocked2.file_path}", "--headless", "--run-time", - "5s", + "2s", "-u", "10", "-r", @@ -1053,7 +1053,7 @@ def t(self): mocked.file_path, "--headless", "--run-time", - "1s", + "0.5", "-u", "3", ], @@ -1674,8 +1674,10 @@ def t(self): "1", "-u", "3", + "-r", + "99", "-t", - "5s", + "1s", ], stderr=STDOUT, stdout=PIPE, @@ -1737,8 +1739,10 @@ def t(self): "1", "-u", "3", + "-r", + "99", "-t", - "5s", + "1s", ], stderr=STDOUT, stdout=PIPE, @@ -1759,7 +1763,7 @@ def t(self): proc_worker.communicate() self.assertIn( - 'Spawning is complete and report waittime is expired, but not all reports received from workers: {"User1": 2} (2 total users)', + "Spawning is complete and report waittime is expired, but not all reports received from workers:", stdout, ) self.assertIn("Shutting down (exit code 0)", stdout) @@ -1808,7 +1812,7 @@ def t(self): stdout=PIPE, text=True, ) - gevent.sleep(2) + gevent.sleep(1) proc_worker2 = subprocess.Popen( [ "locust", @@ -1858,7 +1862,7 @@ def t(self): stdout=PIPE, text=True, ) - gevent.sleep(2) + gevent.sleep(1) proc = subprocess.Popen( [ "locust", @@ -1916,7 +1920,6 @@ def t(self): stdout=PIPE, text=True, ) - gevent.sleep(2) proc_worker = subprocess.Popen( [ "locust", @@ -1998,6 +2001,7 @@ def hello_world(self): self.assertEqual(dict, type(result["num_reqs_per_sec"])) self.assertEqual(dict, type(result["num_fail_per_sec"])) + @unittest.skipIf(True, reason="This test is too slow for the value it provides") def test_worker_indexes(self): content = """ from locust import HttpUser, task, between