locust 2.23.0__py3-none-any.whl → 2.23.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- locust/_version.py +2 -2
- locust/argument_parser.py +17 -6
- locust/main.py +4 -0
- locust/runners.py +1 -1
- locust/test/test_main.py +5 -2
- locust/webui/dist/assets/{index-5730ea01.js → index-fcdc76c8.js} +51 -51
- locust/webui/dist/auth.html +1 -1
- locust/webui/dist/index.html +1 -1
- {locust-2.23.0.dist-info → locust-2.23.1.dist-info}/METADATA +1 -1
- {locust-2.23.0.dist-info → locust-2.23.1.dist-info}/RECORD +14 -14
- {locust-2.23.0.dist-info → locust-2.23.1.dist-info}/LICENSE +0 -0
- {locust-2.23.0.dist-info → locust-2.23.1.dist-info}/WHEEL +0 -0
- {locust-2.23.0.dist-info → locust-2.23.1.dist-info}/entry_points.txt +0 -0
- {locust-2.23.0.dist-info → locust-2.23.1.dist-info}/top_level.txt +0 -0
locust/_version.py
CHANGED
locust/argument_parser.py
CHANGED
@@ -156,7 +156,7 @@ def is_url(url: str) -> bool:
|
|
156
156
|
return False
|
157
157
|
|
158
158
|
|
159
|
-
def
|
159
|
+
def download_locustfile_from_url(url: str) -> str:
|
160
160
|
try:
|
161
161
|
response = requests.get(url)
|
162
162
|
except requests.exceptions.RequestException as e:
|
@@ -167,7 +167,10 @@ def download_file_from_url(url: str) -> str:
|
|
167
167
|
locustfile.write(response.text)
|
168
168
|
|
169
169
|
def exit_handler():
|
170
|
-
|
170
|
+
try:
|
171
|
+
os.remove(locustfile.name)
|
172
|
+
except FileNotFoundError:
|
173
|
+
pass # this is normal when multiple workers are running on the same machine
|
171
174
|
|
172
175
|
atexit.register(exit_handler)
|
173
176
|
return locustfile.name
|
@@ -246,11 +249,19 @@ def download_locustfile_from_master(master_host: str, master_port: int) -> str:
|
|
246
249
|
sys.exit(1)
|
247
250
|
|
248
251
|
filename = msg.data["filename"]
|
249
|
-
with open(filename, "w") as
|
250
|
-
|
252
|
+
with open(os.path.join(tempfile.gettempdir(), filename), "w") as locustfile:
|
253
|
+
locustfile.write(msg.data["contents"])
|
254
|
+
|
255
|
+
def exit_handler():
|
256
|
+
try:
|
257
|
+
os.remove(locustfile.name)
|
258
|
+
except FileNotFoundError:
|
259
|
+
pass # this is normal when multiple workers are running on the same machine
|
260
|
+
|
261
|
+
atexit.register(exit_handler)
|
251
262
|
|
252
263
|
tempclient.close()
|
253
|
-
return
|
264
|
+
return locustfile.name
|
254
265
|
|
255
266
|
|
256
267
|
def parse_locustfile_option(args=None) -> list[str]:
|
@@ -312,7 +323,7 @@ def parse_locustfile_option(args=None) -> list[str]:
|
|
312
323
|
|
313
324
|
# Comma separated string to list
|
314
325
|
locustfile_as_list = [
|
315
|
-
|
326
|
+
download_locustfile_from_url(f) if is_url(f.strip()) else f.strip() for f in options.locustfile.split(",")
|
316
327
|
]
|
317
328
|
|
318
329
|
# Checking if the locustfile is a single file, multiple files or a directory
|
locust/main.py
CHANGED
@@ -132,6 +132,10 @@ def main():
|
|
132
132
|
logging.error("stats.PERCENTILES_TO_CHART parameter should be 2 parameters \n")
|
133
133
|
sys.exit(1)
|
134
134
|
|
135
|
+
if len(stats.MODERN_UI_PERCENTILES_TO_CHART) > 6:
|
136
|
+
logging.error("stats.MODERN_UI_PERCENTILES_TO_CHART parameter should be a maximum of 6 parameters \n")
|
137
|
+
sys.exit(1)
|
138
|
+
|
135
139
|
def is_valid_percentile(parameter):
|
136
140
|
try:
|
137
141
|
if 0 < float(parameter) < 1:
|
locust/runners.py
CHANGED
@@ -1064,7 +1064,7 @@ class MasterRunner(DistributedRunner):
|
|
1064
1064
|
self.send_message(
|
1065
1065
|
"locustfile",
|
1066
1066
|
client_id=client_id,
|
1067
|
-
data={"filename": filename, "contents": file_contents},
|
1067
|
+
data={"filename": os.path.basename(filename), "contents": file_contents},
|
1068
1068
|
)
|
1069
1069
|
continue
|
1070
1070
|
elif msg.type == "client_stopped":
|
locust/test/test_main.py
CHANGED
@@ -1721,12 +1721,15 @@ class SecondUser(HttpUser):
|
|
1721
1721
|
text=True,
|
1722
1722
|
)
|
1723
1723
|
stdout = proc.communicate()[0]
|
1724
|
-
|
1725
|
-
|
1724
|
+
stdout_worker = proc_worker.communicate()[0]
|
1725
|
+
stdout_worker2 = proc_worker2.communicate()[0]
|
1726
1726
|
|
1727
1727
|
self.assertIn('All users spawned: {"User1": 1} (1 total users)', stdout)
|
1728
1728
|
self.assertIn("Locustfile contents changed on disk after first worker requested locustfile", stdout)
|
1729
1729
|
self.assertIn("Shutting down (exit code 0)", stdout)
|
1730
|
+
self.assertNotIn("Traceback", stdout)
|
1731
|
+
self.assertNotIn("Traceback", stdout_worker)
|
1732
|
+
self.assertNotIn("Traceback", stdout_worker2)
|
1730
1733
|
|
1731
1734
|
self.assertEqual(0, proc.returncode)
|
1732
1735
|
self.assertEqual(0, proc_worker.returncode)
|