locust 2.25.1.dev17__py3-none-any.whl → 2.26.1.dev7__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 +1 -1
- locust/dispatch.py +2 -4
- locust/rpc/protocol.py +1 -1
- locust/runners.py +3 -3
- locust/test/mock_locustfile.py +0 -2
- locust/test/mock_logging.py +1 -2
- locust/test/test_dispatch.py +8 -34
- locust/test/test_env.py +3 -3
- locust/test/test_fasthttp.py +9 -9
- locust/test/test_http.py +7 -7
- locust/test/test_locust_class.py +4 -4
- locust/test/test_main.py +2 -2
- locust/test/test_parser.py +9 -8
- locust/test/test_runners.py +0 -1
- locust/test/test_web.py +2 -6
- {locust-2.25.1.dev17.dist-info → locust-2.26.1.dev7.dist-info}/METADATA +3 -3
- {locust-2.25.1.dev17.dist-info → locust-2.26.1.dev7.dist-info}/RECORD +22 -22
- {locust-2.25.1.dev17.dist-info → locust-2.26.1.dev7.dist-info}/LICENSE +0 -0
- {locust-2.25.1.dev17.dist-info → locust-2.26.1.dev7.dist-info}/WHEEL +0 -0
- {locust-2.25.1.dev17.dist-info → locust-2.26.1.dev7.dist-info}/entry_points.txt +0 -0
- {locust-2.25.1.dev17.dist-info → locust-2.26.1.dev7.dist-info}/top_level.txt +0 -0
locust/_version.py
CHANGED
@@ -12,5 +12,5 @@ __version__: str
|
|
12
12
|
__version_tuple__: VERSION_TUPLE
|
13
13
|
version_tuple: VERSION_TUPLE
|
14
14
|
|
15
|
-
__version__ = version = '2.
|
16
|
-
__version_tuple__ = version_tuple = (2,
|
15
|
+
__version__ = version = '2.26.1.dev7'
|
16
|
+
__version_tuple__ = version_tuple = (2, 26, 1, 'dev7')
|
locust/argument_parser.py
CHANGED
@@ -666,7 +666,7 @@ Typically ONLY these options (and --locustfile) need to be specified on workers,
|
|
666
666
|
nargs="*",
|
667
667
|
metavar="<tag>",
|
668
668
|
env_var="LOCUST_TAGS",
|
669
|
-
help="List of tags to include in the test, so only tasks with
|
669
|
+
help="List of tags to include in the test, so only tasks with at least one matching tag will be executed",
|
670
670
|
)
|
671
671
|
tag_group.add_argument(
|
672
672
|
"-E",
|
locust/dispatch.py
CHANGED
@@ -100,8 +100,7 @@ class UsersDispatcher(Iterator):
|
|
100
100
|
self._no_user_to_spawn = False
|
101
101
|
|
102
102
|
def get_current_user_count(self) -> int:
|
103
|
-
|
104
|
-
return sum(map(sum, map(dict.values, self._users_on_workers.values()))) # type: ignore
|
103
|
+
return sum(map(sum, map(dict.values, self._users_on_workers.values())))
|
105
104
|
|
106
105
|
@property
|
107
106
|
def dispatch_in_progress(self):
|
@@ -449,5 +448,4 @@ class UsersDispatcher(Iterator):
|
|
449
448
|
The implementation was profiled and compared to other implementations such as dict-comprehensions
|
450
449
|
and the one below is the most efficient.
|
451
450
|
"""
|
452
|
-
|
453
|
-
return dict(zip(users_on_workers.keys(), map(dict.copy, users_on_workers.values()))) # type: ignore
|
451
|
+
return dict(zip(users_on_workers.keys(), map(dict.copy, users_on_workers.values())))
|
locust/rpc/protocol.py
CHANGED
locust/runners.py
CHANGED
@@ -345,10 +345,10 @@ class Runner:
|
|
345
345
|
return
|
346
346
|
elif self.shape_last_tick != current_tick:
|
347
347
|
if len(current_tick) == 2:
|
348
|
-
user_count, spawn_rate = current_tick
|
348
|
+
user_count, spawn_rate = current_tick
|
349
349
|
user_classes = None
|
350
350
|
else:
|
351
|
-
user_count, spawn_rate, user_classes = current_tick
|
351
|
+
user_count, spawn_rate, user_classes = current_tick
|
352
352
|
logger.info("Shape test updating to %d users at %.2f spawn rate" % (user_count, spawn_rate))
|
353
353
|
# TODO: This `self.start()` call is blocking until the ramp-up is completed. This can leads
|
354
354
|
# to unexpected behaviours such as the one in the following example:
|
@@ -1453,7 +1453,7 @@ class WorkerRunner(DistributedRunner):
|
|
1453
1453
|
|
1454
1454
|
|
1455
1455
|
def _format_user_classes_count_for_log(user_classes_count: dict[str, int]) -> str:
|
1456
|
-
return "{} ({} total users)".format(
|
1456
|
+
return "{} ({} total users)".format( # noqa: UP032
|
1457
1457
|
json.dumps(dict(sorted(user_classes_count.items(), key=itemgetter(0)))),
|
1458
1458
|
sum(user_classes_count.values()),
|
1459
1459
|
)
|
locust/test/mock_locustfile.py
CHANGED
locust/test/mock_logging.py
CHANGED
locust/test/test_dispatch.py
CHANGED
@@ -2167,9 +2167,7 @@ class TestLargeScale(unittest.TestCase):
|
|
2167
2167
|
dispatch_iteration_duration <= tol
|
2168
2168
|
for dispatch_iteration_duration in users_dispatcher.dispatch_iteration_durations
|
2169
2169
|
),
|
2170
|
-
"One or more dispatch took more than {:.0f}s to compute (max = {}ms)"
|
2171
|
-
tol * 1000, 1000 * max(users_dispatcher.dispatch_iteration_durations)
|
2172
|
-
),
|
2170
|
+
f"One or more dispatch took more than {tol * 1000:.0f}s to compute (max = {1000 * max(users_dispatcher.dispatch_iteration_durations)}ms)",
|
2173
2171
|
)
|
2174
2172
|
|
2175
2173
|
self.assertEqual(_user_count(all_dispatched_users[-1]), target_user_count)
|
@@ -2181,9 +2179,7 @@ class TestLargeScale(unittest.TestCase):
|
|
2181
2179
|
self.assertLessEqual(
|
2182
2180
|
max(user_count_on_workers) - min(user_count_on_workers),
|
2183
2181
|
1,
|
2184
|
-
"One or more workers have too much users compared to the other workers when user count is {}"
|
2185
|
-
_user_count(dispatch_users)
|
2186
|
-
),
|
2182
|
+
f"One or more workers have too much users compared to the other workers when user count is {_user_count(dispatch_users)}",
|
2187
2183
|
)
|
2188
2184
|
|
2189
2185
|
for i, dispatch_users in enumerate(all_dispatched_users):
|
@@ -2202,9 +2198,7 @@ class TestLargeScale(unittest.TestCase):
|
|
2202
2198
|
self.assertLessEqual(
|
2203
2199
|
error_percent,
|
2204
2200
|
tol,
|
2205
|
-
"Distribution for user class {} is off by more than {}% when user count is {}"
|
2206
|
-
user_class, tol, _user_count(dispatch_users)
|
2207
|
-
),
|
2201
|
+
f"Distribution for user class {user_class} is off by more than {tol}% when user count is {_user_count(dispatch_users)}",
|
2208
2202
|
)
|
2209
2203
|
|
2210
2204
|
def test_ramp_down_from_100_000_to_0_users_with_50_user_classes_and_1000_workers_and_5000_spawn_rate(self):
|
@@ -2236,9 +2230,7 @@ class TestLargeScale(unittest.TestCase):
|
|
2236
2230
|
dispatch_iteration_duration <= tol
|
2237
2231
|
for dispatch_iteration_duration in users_dispatcher.dispatch_iteration_durations
|
2238
2232
|
),
|
2239
|
-
"One or more dispatch took more than {:.0f}ms to compute (max = {}ms)"
|
2240
|
-
tol * 1000, 1000 * max(users_dispatcher.dispatch_iteration_durations)
|
2241
|
-
),
|
2233
|
+
f"One or more dispatch took more than {tol * 1000:.0f}ms to compute (max = {1000 * max(users_dispatcher.dispatch_iteration_durations)}ms)",
|
2242
2234
|
)
|
2243
2235
|
|
2244
2236
|
self.assertEqual(_user_count(all_dispatched_users[-1]), 0)
|
@@ -2250,9 +2242,7 @@ class TestLargeScale(unittest.TestCase):
|
|
2250
2242
|
self.assertLessEqual(
|
2251
2243
|
max(user_count_on_workers) - min(user_count_on_workers),
|
2252
2244
|
1,
|
2253
|
-
"One or more workers have too much users compared to the other workers when user count is {}"
|
2254
|
-
_user_count(dispatch_users)
|
2255
|
-
),
|
2245
|
+
f"One or more workers have too much users compared to the other workers when user count is {_user_count(dispatch_users)}",
|
2256
2246
|
)
|
2257
2247
|
|
2258
2248
|
for dispatch_users in all_dispatched_users[:-1]:
|
@@ -2267,9 +2257,7 @@ class TestLargeScale(unittest.TestCase):
|
|
2267
2257
|
self.assertLessEqual(
|
2268
2258
|
error_percent,
|
2269
2259
|
tol,
|
2270
|
-
"Distribution for user class {} is off by more than {}% when user count is {}"
|
2271
|
-
user_class, tol, _user_count(dispatch_users)
|
2272
|
-
),
|
2260
|
+
f"Distribution for user class {user_class} is off by more than {tol}% when user count is {_user_count(dispatch_users)}",
|
2273
2261
|
)
|
2274
2262
|
|
2275
2263
|
|
@@ -3448,9 +3436,7 @@ class TestRampUpUsersFromZeroWithFixed(unittest.TestCase):
|
|
3448
3436
|
self.target_user_count = target_user_count
|
3449
3437
|
|
3450
3438
|
def __str__(self):
|
3451
|
-
return "<RampUpCase fixed_counts={} weights={} target_user_count={}>"
|
3452
|
-
self.fixed_counts, self.weights, self.target_user_count
|
3453
|
-
)
|
3439
|
+
return f"<RampUpCase fixed_counts={self.fixed_counts} weights={self.weights} target_user_count={self.target_user_count}>"
|
3454
3440
|
|
3455
3441
|
def case_handler(self, cases: list[RampUpCase], expected: list[dict[str, int]], user_classes: list[type[User]]):
|
3456
3442
|
self.assertEqual(len(cases), len(expected))
|
@@ -3734,8 +3720,6 @@ class TestRampUpDifferentUsers(unittest.TestCase):
|
|
3734
3720
|
|
3735
3721
|
worker_node1 = WorkerNode("1")
|
3736
3722
|
|
3737
|
-
sleep_time = 0.2
|
3738
|
-
|
3739
3723
|
user_dispatcher = UsersDispatcher(worker_nodes=[worker_node1], user_classes=[User1, User2, User3])
|
3740
3724
|
|
3741
3725
|
user_dispatcher.new_dispatch(target_user_count=3, spawn_rate=3)
|
@@ -3761,8 +3745,6 @@ class TestRampUpDifferentUsers(unittest.TestCase):
|
|
3761
3745
|
|
3762
3746
|
worker_node1 = WorkerNode("1")
|
3763
3747
|
|
3764
|
-
sleep_time = 0.2
|
3765
|
-
|
3766
3748
|
user_dispatcher = UsersDispatcher(worker_nodes=[worker_node1], user_classes=[User1, User2, User3])
|
3767
3749
|
|
3768
3750
|
user_dispatcher.new_dispatch(target_user_count=10, spawn_rate=10, user_classes=[User2])
|
@@ -3780,8 +3762,6 @@ class TestRampUpDifferentUsers(unittest.TestCase):
|
|
3780
3762
|
|
3781
3763
|
worker_node1 = WorkerNode("1")
|
3782
3764
|
|
3783
|
-
sleep_time = 0.2
|
3784
|
-
|
3785
3765
|
user_dispatcher = UsersDispatcher(worker_nodes=[worker_node1], user_classes=[User1, User2, User3])
|
3786
3766
|
|
3787
3767
|
user_dispatcher.new_dispatch(target_user_count=10, spawn_rate=10, user_classes=[User2])
|
@@ -3802,8 +3782,6 @@ class TestRampUpDifferentUsers(unittest.TestCase):
|
|
3802
3782
|
|
3803
3783
|
worker_node1 = WorkerNode("1")
|
3804
3784
|
|
3805
|
-
sleep_time = 0.2
|
3806
|
-
|
3807
3785
|
user_dispatcher = UsersDispatcher(worker_nodes=[worker_node1], user_classes=[User1, User2, User3])
|
3808
3786
|
|
3809
3787
|
user_dispatcher.new_dispatch(target_user_count=10, spawn_rate=10, user_classes=[User2])
|
@@ -3826,8 +3804,6 @@ class TestRampUpDifferentUsers(unittest.TestCase):
|
|
3826
3804
|
worker_node2 = WorkerNode("2")
|
3827
3805
|
worker_node3 = WorkerNode("3")
|
3828
3806
|
|
3829
|
-
sleep_time = 0.2
|
3830
|
-
|
3831
3807
|
user_dispatcher = UsersDispatcher(
|
3832
3808
|
worker_nodes=[worker_node1, worker_node2, worker_node3], user_classes=[User1, User2, User3]
|
3833
3809
|
)
|
@@ -3886,8 +3862,6 @@ class TestRampUpDifferentUsers(unittest.TestCase):
|
|
3886
3862
|
worker_node2 = WorkerNode("2")
|
3887
3863
|
worker_node3 = WorkerNode("3")
|
3888
3864
|
|
3889
|
-
sleep_time = 0.2
|
3890
|
-
|
3891
3865
|
user_dispatcher = UsersDispatcher(
|
3892
3866
|
worker_nodes=[worker_node1, worker_node2, worker_node3], user_classes=[User1, User2, User3]
|
3893
3867
|
)
|
@@ -4155,7 +4129,7 @@ def _aggregate_dispatched_users(d: dict[str, dict[str, int]]) -> dict[str, int]:
|
|
4155
4129
|
|
4156
4130
|
|
4157
4131
|
def _user_count(d: dict[str, dict[str, int]]) -> int:
|
4158
|
-
return sum(map(sum, map(dict.values, d.values())))
|
4132
|
+
return sum(map(sum, map(dict.values, d.values())))
|
4159
4133
|
|
4160
4134
|
|
4161
4135
|
def _user_count_on_worker(d: dict[str, dict[str, int]], worker_node_id: str) -> int:
|
locust/test/test_env.py
CHANGED
@@ -36,7 +36,7 @@ class TestEnvironment(LocustTestCase):
|
|
36
36
|
|
37
37
|
def test_user_classes_with_same_name_is_error(self):
|
38
38
|
with self.assertRaises(ValueError) as e:
|
39
|
-
|
39
|
+
Environment(user_classes=[MyUserWithSameName1, MyUserWithSameName2])
|
40
40
|
|
41
41
|
self.assertEqual(
|
42
42
|
e.exception.args[0],
|
@@ -186,7 +186,7 @@ class TestEnvironment(LocustTestCase):
|
|
186
186
|
pass
|
187
187
|
|
188
188
|
with self.assertRaises(ValueError) as e:
|
189
|
-
|
189
|
+
Environment(user_classes=[MyUser1, MyUser2])
|
190
190
|
|
191
191
|
self.assertEqual(
|
192
192
|
e.exception.args[0],
|
@@ -269,7 +269,7 @@ class TestEnvironment(LocustTestCase):
|
|
269
269
|
available_user_classes={"User1": MyUser1, "User2": MyUser2},
|
270
270
|
available_user_tasks={"User1": MyUser1.tasks, "User2": MyUser2.tasks},
|
271
271
|
)
|
272
|
-
|
272
|
+
worker_env.create_worker_runner("127.0.0.1", master.server.port)
|
273
273
|
|
274
274
|
master_env.update_user_class({"user_class_name": "User1", "host": "http://localhost", "tasks": ["my_task_2"]})
|
275
275
|
|
locust/test/test_fasthttp.py
CHANGED
@@ -96,7 +96,7 @@ class TestFastHttpSession(WebserverTestCase):
|
|
96
96
|
def test_slow_redirect(self):
|
97
97
|
s = self.get_client()
|
98
98
|
url = "/redirect?url=/redirect&delay=0.5"
|
99
|
-
|
99
|
+
s.get(url)
|
100
100
|
stats = self.runner.stats.get(url, method="GET")
|
101
101
|
self.assertEqual(1, stats.num_requests)
|
102
102
|
self.assertGreater(stats.avg_response_time, 500)
|
@@ -187,7 +187,7 @@ class TestFastHttpSession(WebserverTestCase):
|
|
187
187
|
with s.get("/fail", catch_response=True) as r:
|
188
188
|
r.success()
|
189
189
|
raise OtherException("wtf")
|
190
|
-
except OtherException
|
190
|
+
except OtherException:
|
191
191
|
pass
|
192
192
|
else:
|
193
193
|
self.fail("OtherException should have been raised")
|
@@ -197,14 +197,14 @@ class TestFastHttpSession(WebserverTestCase):
|
|
197
197
|
|
198
198
|
def test_catch_response_default_success(self):
|
199
199
|
s = self.get_client()
|
200
|
-
with s.get("/ultra_fast", catch_response=True)
|
200
|
+
with s.get("/ultra_fast", catch_response=True):
|
201
201
|
pass
|
202
202
|
self.assertEqual(1, self.environment.stats.get("/ultra_fast", "GET").num_requests)
|
203
203
|
self.assertEqual(0, self.environment.stats.get("/ultra_fast", "GET").num_failures)
|
204
204
|
|
205
205
|
def test_catch_response_default_fail(self):
|
206
206
|
s = self.get_client()
|
207
|
-
with s.get("/fail", catch_response=True)
|
207
|
+
with s.get("/fail", catch_response=True):
|
208
208
|
pass
|
209
209
|
self.assertEqual(1, self.environment.stats.total.num_requests)
|
210
210
|
self.assertEqual(1, self.environment.stats.total.num_failures)
|
@@ -301,7 +301,7 @@ class TestRequestStatsWithWebserver(WebserverTestCase):
|
|
301
301
|
|
302
302
|
l = MyUser(self.environment)
|
303
303
|
path = "/no_content_length"
|
304
|
-
|
304
|
+
l.client.get(path)
|
305
305
|
self.assertEqual(
|
306
306
|
self.runner.stats.get(path, "GET").avg_content_length,
|
307
307
|
len("This response does not have content-length in the header"),
|
@@ -313,7 +313,7 @@ class TestRequestStatsWithWebserver(WebserverTestCase):
|
|
313
313
|
|
314
314
|
l = MyUser(self.environment)
|
315
315
|
path = "/no_content_length"
|
316
|
-
|
316
|
+
l.client.get(path, stream=True)
|
317
317
|
self.assertEqual(0, self.runner.stats.get(path, "GET").avg_content_length)
|
318
318
|
|
319
319
|
def test_request_stats_named_endpoint(self):
|
@@ -526,7 +526,7 @@ class TestFastHttpUserClass(WebserverTestCase):
|
|
526
526
|
def test_slow_redirect(self):
|
527
527
|
s = FastHttpSession(self.environment, "http://127.0.0.1:%i" % self.port, user=None)
|
528
528
|
url = "/redirect?url=/redirect&delay=0.5"
|
529
|
-
|
529
|
+
s.get(url)
|
530
530
|
stats = self.runner.stats.get(url, method="GET")
|
531
531
|
self.assertEqual(1, stats.num_requests)
|
532
532
|
self.assertGreater(stats.avg_response_time, 500)
|
@@ -650,7 +650,7 @@ class TestFastHttpCatchResponse(WebserverTestCase):
|
|
650
650
|
self.assertEqual(1, self.num_success)
|
651
651
|
|
652
652
|
def test_catch_response_http_fail(self):
|
653
|
-
with self.user.client.get("/fail", catch_response=True)
|
653
|
+
with self.user.client.get("/fail", catch_response=True):
|
654
654
|
pass
|
655
655
|
self.assertEqual(1, self.num_failures)
|
656
656
|
self.assertEqual(0, self.num_success)
|
@@ -683,7 +683,7 @@ class TestFastHttpCatchResponse(WebserverTestCase):
|
|
683
683
|
class MyTaskSet(TaskSet):
|
684
684
|
@task
|
685
685
|
def interrupted_task(self):
|
686
|
-
with self.client.get("/ultra_fast", catch_response=True)
|
686
|
+
with self.client.get("/ultra_fast", catch_response=True):
|
687
687
|
raise InterruptTaskSet()
|
688
688
|
|
689
689
|
class MyUser(FastHttpUser):
|
locust/test/test_http.py
CHANGED
@@ -65,7 +65,7 @@ class TestHttpSession(WebserverTestCase):
|
|
65
65
|
def test_slow_redirect(self):
|
66
66
|
s = self.get_client()
|
67
67
|
url = "/redirect?url=/redirect&delay=0.5"
|
68
|
-
|
68
|
+
s.get(url)
|
69
69
|
stats = self.runner.stats.get(url, method="GET")
|
70
70
|
self.assertEqual(1, stats.num_requests)
|
71
71
|
self.assertGreater(stats.avg_response_time, 500)
|
@@ -217,7 +217,7 @@ class TestHttpSession(WebserverTestCase):
|
|
217
217
|
with s.get("/fail", catch_response=True) as r:
|
218
218
|
r.success()
|
219
219
|
raise OtherException("wtf")
|
220
|
-
except OtherException
|
220
|
+
except OtherException:
|
221
221
|
pass
|
222
222
|
else:
|
223
223
|
self.fail("OtherException should have been raised")
|
@@ -228,9 +228,9 @@ class TestHttpSession(WebserverTestCase):
|
|
228
228
|
def test_catch_response_response_error(self):
|
229
229
|
s = self.get_client()
|
230
230
|
try:
|
231
|
-
with s.get("/fail", catch_response=True)
|
231
|
+
with s.get("/fail", catch_response=True):
|
232
232
|
raise ResponseError("response error")
|
233
|
-
except ResponseError
|
233
|
+
except ResponseError:
|
234
234
|
self.fail("ResponseError should not have been raised")
|
235
235
|
|
236
236
|
self.assertEqual(1, self.environment.stats.total.num_requests)
|
@@ -238,14 +238,14 @@ class TestHttpSession(WebserverTestCase):
|
|
238
238
|
|
239
239
|
def test_catch_response_default_success(self):
|
240
240
|
s = self.get_client()
|
241
|
-
with s.get("/ultra_fast", catch_response=True)
|
241
|
+
with s.get("/ultra_fast", catch_response=True):
|
242
242
|
pass
|
243
243
|
self.assertEqual(1, self.environment.stats.get("/ultra_fast", "GET").num_requests)
|
244
244
|
self.assertEqual(0, self.environment.stats.get("/ultra_fast", "GET").num_failures)
|
245
245
|
|
246
246
|
def test_catch_response_default_fail(self):
|
247
247
|
s = self.get_client()
|
248
|
-
with s.get("/fail", catch_response=True)
|
248
|
+
with s.get("/fail", catch_response=True):
|
249
249
|
pass
|
250
250
|
self.assertEqual(1, self.environment.stats.total.num_requests)
|
251
251
|
self.assertEqual(1, self.environment.stats.total.num_failures)
|
@@ -260,7 +260,7 @@ class TestHttpSession(WebserverTestCase):
|
|
260
260
|
|
261
261
|
self.environment.events.request.add_listener(on_request)
|
262
262
|
|
263
|
-
with s.get("/wrong_url/01", name="replaced_url_name")
|
263
|
+
with s.get("/wrong_url/01", name="replaced_url_name"):
|
264
264
|
pass
|
265
265
|
|
266
266
|
self.assertIn("for url: replaced_url_name", str(kwargs["exception"]))
|
locust/test/test_locust_class.py
CHANGED
@@ -748,19 +748,19 @@ class TestCatchResponse(WebserverTestCase):
|
|
748
748
|
self.assertEqual(1, self.num_failures)
|
749
749
|
self.assertEqual(0, self.num_success)
|
750
750
|
|
751
|
-
with self.locust.client.get("/ultra_fast", catch_response=True)
|
751
|
+
with self.locust.client.get("/ultra_fast", catch_response=True):
|
752
752
|
pass
|
753
753
|
self.assertEqual(1, self.num_failures)
|
754
754
|
self.assertEqual(1, self.num_success)
|
755
755
|
|
756
|
-
with self.locust.client.get("/ultra_fast", catch_response=True)
|
756
|
+
with self.locust.client.get("/ultra_fast", catch_response=True):
|
757
757
|
raise ResponseError("Not working")
|
758
758
|
|
759
759
|
self.assertEqual(2, self.num_failures)
|
760
760
|
self.assertEqual(1, self.num_success)
|
761
761
|
|
762
762
|
def test_catch_response_http_fail(self):
|
763
|
-
with self.locust.client.get("/fail", catch_response=True)
|
763
|
+
with self.locust.client.get("/fail", catch_response=True):
|
764
764
|
pass
|
765
765
|
self.assertEqual(1, self.num_failures)
|
766
766
|
self.assertEqual(0, self.num_success)
|
@@ -793,7 +793,7 @@ class TestCatchResponse(WebserverTestCase):
|
|
793
793
|
class MyTaskSet(TaskSet):
|
794
794
|
@task
|
795
795
|
def interrupted_task(self):
|
796
|
-
with self.client.get("/ultra_fast", catch_response=True)
|
796
|
+
with self.client.get("/ultra_fast", catch_response=True):
|
797
797
|
raise InterruptTaskSet()
|
798
798
|
|
799
799
|
class MyUser(HttpUser):
|
locust/test/test_main.py
CHANGED
@@ -811,7 +811,7 @@ class StandaloneIntegrationTests(ProcessIntegrationTest):
|
|
811
811
|
try:
|
812
812
|
response = requests.get(f"http://localhost:{port}/")
|
813
813
|
except ConnectionError:
|
814
|
-
|
814
|
+
success = False
|
815
815
|
try:
|
816
816
|
_, stderr = proc.communicate(timeout=5)
|
817
817
|
except subprocess.TimeoutExpired:
|
@@ -1084,7 +1084,7 @@ class StandaloneIntegrationTests(ProcessIntegrationTest):
|
|
1084
1084
|
with mock_locustfile() as mocked:
|
1085
1085
|
with temporary_file("", suffix=".html") as html_report_file_path:
|
1086
1086
|
try:
|
1087
|
-
|
1087
|
+
subprocess.check_output(
|
1088
1088
|
[
|
1089
1089
|
"locust",
|
1090
1090
|
"-f",
|
locust/test/test_parser.py
CHANGED
@@ -69,6 +69,8 @@ class TestParser(unittest.TestCase):
|
|
69
69
|
web-port = 45787
|
70
70
|
headless = true
|
71
71
|
tags = ["Critical", "Normal"]
|
72
|
+
[tool.something_else]
|
73
|
+
this = "should be ignored by locust"
|
72
74
|
"""
|
73
75
|
|
74
76
|
file.write(config_data)
|
@@ -248,7 +250,7 @@ class TestArgumentParser(LocustTestCase):
|
|
248
250
|
def test_parse_locustfile_empty_directory_error(self):
|
249
251
|
with mock.patch("sys.stderr", new=StringIO()):
|
250
252
|
with self.assertRaises(SystemExit):
|
251
|
-
|
253
|
+
parse_locustfile_option(
|
252
254
|
args=[
|
253
255
|
"-f",
|
254
256
|
self.parent_dir.name,
|
@@ -258,7 +260,7 @@ class TestArgumentParser(LocustTestCase):
|
|
258
260
|
def test_parse_locustfile_invalid_directory_error(self):
|
259
261
|
with mock.patch("sys.stderr", new=StringIO()):
|
260
262
|
with self.assertRaises(SystemExit):
|
261
|
-
|
263
|
+
parse_locustfile_option(
|
262
264
|
args=[
|
263
265
|
"-f",
|
264
266
|
"non_existent_dir",
|
@@ -401,13 +403,12 @@ class TestFindLocustfiles(LocustTestCase):
|
|
401
403
|
def test_find_locustfiles_with_multiple_locustfiles(self):
|
402
404
|
with mock_locustfile() as mocked1:
|
403
405
|
with mock_locustfile() as mocked2:
|
404
|
-
|
405
|
-
locustfiles = find_locustfiles([mocked1.file_path, mocked2.file_path], False)
|
406
|
+
locustfiles = find_locustfiles([mocked1.file_path, mocked2.file_path], False)
|
406
407
|
|
407
|
-
|
408
|
-
|
408
|
+
self.assertIn(mocked1.file_path, locustfiles)
|
409
|
+
self.assertIn(mocked2.file_path, locustfiles)
|
409
410
|
|
410
|
-
|
411
|
+
assert 2 == len(locustfiles)
|
411
412
|
|
412
413
|
def test_find_locustfiles_error_for_invalid_file_extension(self):
|
413
414
|
with mock.patch("sys.stderr", new=StringIO()):
|
@@ -450,7 +451,7 @@ class TestLocustfileIsDirectory(LocustTestCase):
|
|
450
451
|
|
451
452
|
def test_locustfile_is_directory_single_locustfile_without_file_extension(self):
|
452
453
|
prefix_name = "foobar"
|
453
|
-
with NamedTemporaryFile(prefix=prefix_name, suffix=".py")
|
454
|
+
with NamedTemporaryFile(prefix=prefix_name, suffix=".py"):
|
454
455
|
is_dir = locustfile_is_directory([prefix_name])
|
455
456
|
assert not is_dir
|
456
457
|
|
locust/test/test_runners.py
CHANGED
@@ -3547,7 +3547,6 @@ class TestWorkerRunner(LocustTestCase):
|
|
3547
3547
|
pass
|
3548
3548
|
|
3549
3549
|
with mock.patch("locust.rpc.rpc.Client", mocked_rpc(raise_on_close=False)) as client:
|
3550
|
-
client_id = id(client)
|
3551
3550
|
worker = self.get_runner(environment=Environment(), user_classes=[MyUser], client=client)
|
3552
3551
|
client.mocked_send(
|
3553
3552
|
Message(
|
locust/test/test_web.py
CHANGED
@@ -1110,11 +1110,7 @@ class TestWebUI(LocustTestCase, _HeaderCheckMixin):
|
|
1110
1110
|
self.environment.available_user_classes = {"User1": MyUser, "User2": MyUser2}
|
1111
1111
|
self.environment.available_user_tasks = {"User1": MyUser.tasks, "User2": MyUser2.tasks}
|
1112
1112
|
|
1113
|
-
|
1114
|
-
available_user_tasks = {"User1": ["my_task", "my_task_2"], "User2": []}
|
1115
|
-
|
1116
|
-
# environment.update_user_class({"user_class_name": "User1", "host": "http://localhost", "tasks": ["my_task_2"]})
|
1117
|
-
response = requests.post(
|
1113
|
+
requests.post(
|
1118
1114
|
"http://127.0.0.1:%i/user" % self.web_port,
|
1119
1115
|
json={"user_class_name": "User1", "host": "http://localhost", "tasks": ["my_task_2"]},
|
1120
1116
|
)
|
@@ -1290,7 +1286,7 @@ class TestModernWebUI(LocustTestCase, _HeaderCheckMixin):
|
|
1290
1286
|
def setUp(self):
|
1291
1287
|
super().setUp()
|
1292
1288
|
|
1293
|
-
|
1289
|
+
get_parser(default_config_files=[])
|
1294
1290
|
self.stats = self.environment.stats
|
1295
1291
|
|
1296
1292
|
self.web_ui = self.environment.create_web_ui("127.0.0.1", 0, modern_ui=True)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: locust
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.26.1.dev7
|
4
4
|
Summary: Developer friendly load testing framework
|
5
5
|
License: MIT
|
6
6
|
Project-URL: Homepage, https://github.com/locustio/locust
|
@@ -32,7 +32,7 @@ Requires-Dist: Werkzeug >=2.0.0
|
|
32
32
|
Requires-Dist: requests >=2.26.0
|
33
33
|
Requires-Dist: msgpack >=1.0.0
|
34
34
|
Requires-Dist: pyzmq >=25.0.0
|
35
|
-
Requires-Dist: geventhttpclient
|
35
|
+
Requires-Dist: geventhttpclient ==2.2.1
|
36
36
|
Requires-Dist: ConfigArgParse >=1.5.5
|
37
37
|
Requires-Dist: psutil >=5.9.1
|
38
38
|
Requires-Dist: Flask-Login >=0.6.3
|
@@ -44,7 +44,7 @@ Requires-Dist: tomli >=1.1.0 ; python_version < "3.11"
|
|
44
44
|
# Locust
|
45
45
|
|
46
46
|
[](https://pypi.org/project/locust/)
|
47
|
-

|
48
48
|
[](https://pepy.tech/project/locust)
|
49
49
|
[](https://github.com/locustio/locust/actions?query=workflow%3ATests)
|
50
50
|
[](https://github.com/locustio/locust/graphs/contributors)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
locust/__init__.py,sha256=g6oA-Ba_hs3gLWVf5MKJ1mvfltI8MFnDWG8qslqm8yg,1402
|
2
2
|
locust/__main__.py,sha256=vBQ82334kX06ImDbFlPFgiBRiLIinwNk3z8Khs6hd74,31
|
3
|
-
locust/_version.py,sha256=
|
4
|
-
locust/argument_parser.py,sha256=
|
3
|
+
locust/_version.py,sha256=3veUhUmsTLjhnzaNLqgswdPQDWWnCSjT1jJuKb3nAJQ,426
|
4
|
+
locust/argument_parser.py,sha256=gOyB1rqEEFNVkhGa-oAuCxf573aB_lATSY9w6FlCbHk,32008
|
5
5
|
locust/clients.py,sha256=-vKHkTkUQwYUXUpuROvHdiAbSbOPY8s4V7xFDF5KU1A,14819
|
6
6
|
locust/debug.py,sha256=We6Z9W0btkKSc7PxWmrZx-xMynvOOsKhG6jmDgQin0g,5134
|
7
|
-
locust/dispatch.py,sha256=
|
7
|
+
locust/dispatch.py,sha256=S2pAMOlbadOrtMTLTDkq1Pvqes3HVUdZl-K5SDss6ig,19313
|
8
8
|
locust/env.py,sha256=nd6ui1bv6n-kkLkP3r61ZkskDY627dsKOAkYHhtOW7o,12472
|
9
9
|
locust/event.py,sha256=xgNKbcejxy1TNUfIdgV75KgD2_BOwQmvjrJ4hWuydRw,7740
|
10
10
|
locust/exception.py,sha256=jGgJ32ubuf4pWdlaVOkbh2Y0LlG0_DHi-lv3ib8ppOE,1791
|
@@ -13,14 +13,14 @@ locust/input_events.py,sha256=WZtjFMJQpPszxgqwZkxzRBOhygHIersHsvt-9S34M9k,3271
|
|
13
13
|
locust/log.py,sha256=2IVp9YL4ZPfWdj3sBFuOHfgneg3g7m7tUGR-sy2s3E8,3155
|
14
14
|
locust/main.py,sha256=emuULU-y1SmHTLcLqfOiZn_SnZzWDcf_IYRmB4Yc348,28194
|
15
15
|
locust/py.typed,sha256=gkWLl8yD4mIZnNYYAIRM8g9VarLvWmTAFeUfEbxJLBw,65
|
16
|
-
locust/runners.py,sha256=
|
16
|
+
locust/runners.py,sha256=CsT0J1RDANceL3BfF7L0nSvYdk9O20vGRy4gtef_Urw,67953
|
17
17
|
locust/shape.py,sha256=t-lwBS8LOjWcKXNL7j2U3zroIXJ1b0fazUwpRYQOKXw,1973
|
18
18
|
locust/stats.py,sha256=l2cxxVre8dvA4MIOD_ZKNj_fYySz5gTGC2f9Rc4-CL0,46134
|
19
19
|
locust/web.py,sha256=tgTRfzAxKBxudjhLkQr5JGppoEOD6hcmZ-i_rGvwOlQ,28245
|
20
20
|
locust/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
21
|
locust/contrib/fasthttp.py,sha256=B_VofSuvb9cehQxlUZnLVvYAr2AquedxeALua4mVOuM,26749
|
22
22
|
locust/rpc/__init__.py,sha256=nVGoHWFQxZjnhCDWjbgXIbmFbN9sizAjkhvSs9_642c,58
|
23
|
-
locust/rpc/protocol.py,sha256=
|
23
|
+
locust/rpc/protocol.py,sha256=n-rb3GZQcAlldYDj4E4GuFGylYj_26GSS5U29meft5Y,1282
|
24
24
|
locust/rpc/zmqrpc.py,sha256=7DLIXzkQr7992zmZwAqNgcqzm7LOQAOQtz0tUGv5-Gg,2637
|
25
25
|
locust/static/chart.js,sha256=Aue4SxJZhv9I3k0Nr2uXTrdrLxsrX7x_a0d4u3a1e_Q,4796
|
26
26
|
locust/static/echarts.common.min.js,sha256=2h6zIZeHk-eGAiC-qYvxv7uW5S1HcyM72K5FbcVhky4,620458
|
@@ -50,21 +50,21 @@ locust/templates/stats_data.html,sha256=MoBvJE41VtG3eriHkP4qWgQs3QNTsFTvS03aCenh
|
|
50
50
|
locust/test/__init__.py,sha256=CaVC4yA4DnCO8EY3LbedPHFg86a9Lqlpe92JuiX3THw,396
|
51
51
|
locust/test/fake_module1_for_env_test.py,sha256=dzGYWCr1SSkd8Yyo68paUNrCNW7YY_QgjRb7sM37gG0,164
|
52
52
|
locust/test/fake_module2_for_env_test.py,sha256=dzGYWCr1SSkd8Yyo68paUNrCNW7YY_QgjRb7sM37gG0,164
|
53
|
-
locust/test/mock_locustfile.py,sha256=
|
54
|
-
locust/test/mock_logging.py,sha256=
|
53
|
+
locust/test/mock_locustfile.py,sha256=4xgoAYlhvdIBjGsLFFN0abpTNM7k12iSkrfTPUQhAMQ,1271
|
54
|
+
locust/test/mock_logging.py,sha256=qapKrKhTdlVc8foJB2Hxjn7SB6soaLeAj3VF4A6kZtw,806
|
55
55
|
locust/test/test_debugging.py,sha256=omQ0w5_Xh1xuTBzkd3VavEIircwtlmoOEHcMInY67vU,1053
|
56
|
-
locust/test/test_dispatch.py,sha256=
|
57
|
-
locust/test/test_env.py,sha256=
|
58
|
-
locust/test/test_fasthttp.py,sha256=
|
59
|
-
locust/test/test_http.py,sha256=
|
56
|
+
locust/test/test_dispatch.py,sha256=CIO10mC0FL8FjubV0jNZfd3q8EFQdZhLlm4QnN7HbPs,167754
|
57
|
+
locust/test/test_env.py,sha256=l0fLl9nubdgzxwFNajmBkJvQc5cO5rOTE4p12lbCbs0,8919
|
58
|
+
locust/test/test_fasthttp.py,sha256=jVA5wWjZxXYW6emzy-lfPC0AOabzT6rDCX0N7DPP9mc,30727
|
59
|
+
locust/test/test_http.py,sha256=VQCVY0inLC0RS-V3E9WHL3vBLGokZjQt0zKSrTNlQmM,12536
|
60
60
|
locust/test/test_interruptable_task.py,sha256=LZKSV-aJNnwfvAxguz6SckBEuGEnfGimoIgVfJ2wQTA,1377
|
61
61
|
locust/test/test_load_locustfile.py,sha256=v-muHoM-CYu8t7DXm4AQtFP2q8RYfnTTUBqj7uVqhig,8494
|
62
|
-
locust/test/test_locust_class.py,sha256=
|
62
|
+
locust/test/test_locust_class.py,sha256=oGhhOX848jHRQnIfFlhLlW-kHGYLyYsfDX8hM07Ro7g,25506
|
63
63
|
locust/test/test_log.py,sha256=YPY6vgTAy1KaNU2qoVvQrTH5x_mzRrljEHrkSBy3yxs,7553
|
64
|
-
locust/test/test_main.py,sha256=
|
64
|
+
locust/test/test_main.py,sha256=lchekHHgQBsY5wOuKbjjVm7U8cJ9qzJWmGSUu_Ebw7k,83553
|
65
65
|
locust/test/test_old_wait_api.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
66
|
-
locust/test/test_parser.py,sha256=
|
67
|
-
locust/test/test_runners.py,sha256=
|
66
|
+
locust/test/test_parser.py,sha256=R2RATAHVC1n4gRYZyRD3yO5P9QMFbruZ3A4dwaw8Up0,18287
|
67
|
+
locust/test/test_runners.py,sha256=rtmm9cV82lc7jqEYW3FTM8CNmLlswTIPr9UbeE5vfPc,159382
|
68
68
|
locust/test/test_sequential_taskset.py,sha256=QjVMWWfGHn9hU5AvPxRDU7Vo5DcVW1VkMVfDA0k9OPE,3398
|
69
69
|
locust/test/test_stats.py,sha256=g5WXKbKtjtPxR_Ixukz04wZUsEC7RkHx5hCNHzofob4,33928
|
70
70
|
locust/test/test_tags.py,sha256=mzhGLPMizSnSItTHLHizYvloxDfuIDAOgelwInyrf28,13138
|
@@ -72,7 +72,7 @@ locust/test/test_taskratio.py,sha256=SQ-sBqeFm2GhkfCD_57-fPzQrk1ilSw3DRb0_nwyxAI
|
|
72
72
|
locust/test/test_users.py,sha256=lp6yAKGK9_MIs9F7s1Vc3561P4oRavhpeVo2y9w3SUU,2135
|
73
73
|
locust/test/test_util.py,sha256=DmFTgNSWWx8zrsx9_ZGO6MsySmBV1H_GzNIVzzyapCM,1229
|
74
74
|
locust/test/test_wait_time.py,sha256=3evSEp6amMWFrzmSYs71MCeIsu7Rtarldb_HnwgSrU0,2353
|
75
|
-
locust/test/test_web.py,sha256=
|
75
|
+
locust/test/test_web.py,sha256=5EL7j8iAZSWlF2t4iGln8euWhC2HQmX6eKbjTSpkq1Q,52413
|
76
76
|
locust/test/test_zmqrpc.py,sha256=kONaZ11hwnneLwaVn7lIDVV7KHpEP2nkxuKhfb9ba3o,2173
|
77
77
|
locust/test/testcases.py,sha256=ZaPYNxSSChAs0nts_13mCGY7WFW8AjXQZdPOvwAK0TY,6961
|
78
78
|
locust/test/util.py,sha256=98HXLClkycNTxLiuy1d3W_tM6dBU9bA-p5ZXMfncaWE,2754
|
@@ -95,9 +95,9 @@ locust/webui/dist/report.html,sha256=sOdZZVgZbqgu86BBCSQf3uQUYXgmgSnXF32JpnyAII8
|
|
95
95
|
locust/webui/dist/assets/favicon.ico,sha256=IUl-rYqfpHdV38e-s0bkmFIeLS-n3Ug0DQxk-h202hI,8348
|
96
96
|
locust/webui/dist/assets/index-941b6e82.js,sha256=G3n5R81Svt0HzbWaV3AV20jLWGLr4X50UZ-Adu2KcxU,1645614
|
97
97
|
locust/webui/dist/assets/logo.png,sha256=EIVPqr6wE_yqguHaqFHIsH0ZACLSrvNWyYO7PbyIj4w,19299
|
98
|
-
locust-2.
|
99
|
-
locust-2.
|
100
|
-
locust-2.
|
101
|
-
locust-2.
|
102
|
-
locust-2.
|
103
|
-
locust-2.
|
98
|
+
locust-2.26.1.dev7.dist-info/LICENSE,sha256=78XGpIn3fHVBfaxlPNUfjVufSN7QsdhpJMRJHv2AFpo,1095
|
99
|
+
locust-2.26.1.dev7.dist-info/METADATA,sha256=oYWSG2mlrlNKusKZA-2gpX6rhfhmMjBFiZfBWLcr3ms,7253
|
100
|
+
locust-2.26.1.dev7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
101
|
+
locust-2.26.1.dev7.dist-info/entry_points.txt,sha256=RAdt8Ku-56m7bFjmdj-MBhbF6h4NX7tVODR9QNnOg0E,44
|
102
|
+
locust-2.26.1.dev7.dist-info/top_level.txt,sha256=XSsjgPA8Ggf9TqKVbkwSqZFuPlZ085X13M9orDycE20,7
|
103
|
+
locust-2.26.1.dev7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|