locust 2.47.1.dev73__tar.gz → 2.48.0__tar.gz
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-2.47.1.dev73 → locust-2.48.0}/PKG-INFO +1 -1
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/_version.py +2 -2
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/argument_parser.py +6 -7
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/clients.py +8 -1
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/contrib/fasthttp.py +5 -1
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/contrib/mqtt.py +16 -17
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/stats.py +13 -6
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/web.py +11 -12
- {locust-2.47.1.dev73 → locust-2.48.0}/pyproject.toml +2 -2
- {locust-2.47.1.dev73 → locust-2.48.0}/.gitignore +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/LICENSE +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/README.md +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/hatch_build.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/__init__.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/__main__.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/contrib/__init__.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/contrib/csv_request_logger.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/contrib/dns.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/contrib/milvus.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/contrib/mongodb.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/contrib/oai.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/contrib/postgres.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/contrib/qdrant.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/contrib/socketio.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/debug.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/dispatch.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/env.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/event.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/exception.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/html.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/input_events.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/log.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/main.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/opentelemetry.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/py.typed +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/rpc/__init__.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/rpc/protocol.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/rpc/zmqrpc.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/runners.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/shape.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/user/__init__.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/user/inspectuser.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/user/markov_taskset.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/user/sequential_taskset.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/user/task.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/user/users.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/user/wait_time.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/util/__init__.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/util/cache.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/util/date.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/util/deprecation.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/util/directory.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/util/exception_handler.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/util/load_locustfile.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/util/rounding.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/util/timespan.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/util/url.py +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/webui/dist/assets/favicon-dark.png +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/webui/dist/assets/favicon-light.png +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/webui/dist/assets/graphs-dark.png +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/webui/dist/assets/graphs-light.png +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/webui/dist/assets/src-Cl6CiemE.js +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/webui/dist/assets/terminal.gif +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/webui/dist/assets/testruns-dark.png +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/webui/dist/assets/testruns-light.png +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/webui/dist/auth.html +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/webui/dist/index.html +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/locust/webui/dist/report.html +0 -0
- {locust-2.47.1.dev73 → locust-2.48.0}/pytest_locust/plugin.py +0 -0
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '2.
|
|
22
|
-
__version_tuple__ = version_tuple = (2,
|
|
21
|
+
__version__ = version = '2.48.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 48, 0)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -174,14 +174,13 @@ def _parse_locustfile_path(path: str) -> list[str]:
|
|
|
174
174
|
if not parsed_paths:
|
|
175
175
|
sys.stderr.write(f"Could not find any locustfiles in directory '{path}'")
|
|
176
176
|
sys.exit(1)
|
|
177
|
+
# If file exists add the abspath
|
|
178
|
+
elif os.path.exists(path) and path.endswith(".py"):
|
|
179
|
+
parsed_paths.append(os.path.abspath(path))
|
|
177
180
|
else:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
else:
|
|
182
|
-
note_about_file_endings = "Ensure your locustfile ends with '.py' or is a directory with locustfiles. "
|
|
183
|
-
sys.stderr.write(f"Could not find '{path}'. {note_about_file_endings}See --help for available options.\n")
|
|
184
|
-
sys.exit(1)
|
|
181
|
+
note_about_file_endings = "Ensure your locustfile ends with '.py' or is a directory with locustfiles. "
|
|
182
|
+
sys.stderr.write(f"Could not find '{path}'. {note_about_file_endings}See --help for available options.\n")
|
|
183
|
+
sys.exit(1)
|
|
185
184
|
|
|
186
185
|
return parsed_paths
|
|
187
186
|
|
|
@@ -103,7 +103,14 @@ class HttpSession(requests.Session):
|
|
|
103
103
|
# remove username and password from the base_url (keeping e.g. the brackets of an IPv6 host)
|
|
104
104
|
netloc = parsed_url.netloc.rpartition("@")[2]
|
|
105
105
|
self.base_url = urlunparse(
|
|
106
|
-
(
|
|
106
|
+
(
|
|
107
|
+
parsed_url.scheme,
|
|
108
|
+
netloc,
|
|
109
|
+
parsed_url.path,
|
|
110
|
+
parsed_url.params,
|
|
111
|
+
parsed_url.query,
|
|
112
|
+
parsed_url.fragment,
|
|
113
|
+
)
|
|
107
114
|
)
|
|
108
115
|
# configure requests to use basic auth (credentials in a URL are percent-encoded)
|
|
109
116
|
self.auth = HTTPBasicAuth(unquote(parsed_url.username), unquote(parsed_url.password))
|
|
@@ -211,7 +211,7 @@ class FastHttpSession:
|
|
|
211
211
|
def request(
|
|
212
212
|
self,
|
|
213
213
|
method: str,
|
|
214
|
-
url: str,
|
|
214
|
+
url: str | bytes,
|
|
215
215
|
name: str | None = None,
|
|
216
216
|
data: str | dict | list | tuple | None = None,
|
|
217
217
|
catch_response: bool = False,
|
|
@@ -254,6 +254,10 @@ class FastHttpSession:
|
|
|
254
254
|
:return: A :py:class:`FastResponse <locust.contrib.fasthttp.FastResponse>` object if catch_response is False, and
|
|
255
255
|
:py:class:`ResponseContextManager <locust.contrib.fasthttp.ResponseContextManager>` if True.
|
|
256
256
|
"""
|
|
257
|
+
# accept a bytes URL, as HttpSession and requests do, and record its name as text
|
|
258
|
+
if isinstance(url, bytes):
|
|
259
|
+
url = url.decode("utf-8")
|
|
260
|
+
|
|
257
261
|
# if group name has been set and no name parameter has been passed in; set the name parameter to group_name
|
|
258
262
|
if self.request_name and not name:
|
|
259
263
|
name = self.request_name
|
|
@@ -492,24 +492,23 @@ class MqttClient(mqtt.Client):
|
|
|
492
492
|
"start_time": start_time,
|
|
493
493
|
},
|
|
494
494
|
)
|
|
495
|
+
elif mid is None:
|
|
496
|
+
# QoS 0 subscriptions do not have a mid, so we'll just fire a success event immediately
|
|
497
|
+
self.environment.events.request.fire(
|
|
498
|
+
request_type=REQUEST_TYPE,
|
|
499
|
+
name=self._generate_event_name("subscribe", qos, subscribe_topic),
|
|
500
|
+
response_time=(time.time() - start_time) * 1000,
|
|
501
|
+
response_length=0,
|
|
502
|
+
exception=None,
|
|
503
|
+
context={
|
|
504
|
+
"client_id": self.client_id,
|
|
505
|
+
"qos": qos,
|
|
506
|
+
"topic": subscribe_topic,
|
|
507
|
+
"start_time": start_time,
|
|
508
|
+
},
|
|
509
|
+
)
|
|
495
510
|
else:
|
|
496
|
-
|
|
497
|
-
# QoS 0 subscriptions do not have a mid, so we'll just fire a success event immediately
|
|
498
|
-
self.environment.events.request.fire(
|
|
499
|
-
request_type=REQUEST_TYPE,
|
|
500
|
-
name=self._generate_event_name("subscribe", qos, subscribe_topic),
|
|
501
|
-
response_time=(time.time() - start_time) * 1000,
|
|
502
|
-
response_length=0,
|
|
503
|
-
exception=None,
|
|
504
|
-
context={
|
|
505
|
-
"client_id": self.client_id,
|
|
506
|
-
"qos": qos,
|
|
507
|
-
"topic": subscribe_topic,
|
|
508
|
-
"start_time": start_time,
|
|
509
|
-
},
|
|
510
|
-
)
|
|
511
|
-
else:
|
|
512
|
-
self._subscribe_requests[mid] = (qos, subscribe_topic, start_time)
|
|
511
|
+
self._subscribe_requests[mid] = (qos, subscribe_topic, start_time)
|
|
513
512
|
|
|
514
513
|
return result, mid
|
|
515
514
|
|
|
@@ -591,16 +591,17 @@ class StatsEntry:
|
|
|
591
591
|
percentile = calculate_response_time_percentile(
|
|
592
592
|
self.response_times, self.num_requests - self.num_none_requests, percent
|
|
593
593
|
)
|
|
594
|
+
return self._within_min_max_response_time(percentile)
|
|
594
595
|
|
|
596
|
+
def _within_min_max_response_time(self, percentile: int) -> int:
|
|
595
597
|
# Since we only use two digits of precision when calculating percentiles while still
|
|
596
598
|
# using the exact values for min and max response times, the following checks make sure
|
|
597
599
|
# that we don't report a percentile > max or percentile < min, e.g. a 95th percentile of
|
|
598
600
|
# 1500 when the slowest request took 1460
|
|
599
601
|
if percentile > self.max_response_time:
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
602
|
+
return self.max_response_time
|
|
603
|
+
if self.min_response_time is not None and percentile < self.min_response_time:
|
|
604
|
+
return self.min_response_time
|
|
604
605
|
return percentile
|
|
605
606
|
|
|
606
607
|
def get_current_response_time_percentile(self, percent: float) -> int | None:
|
|
@@ -639,11 +640,17 @@ class StatsEntry:
|
|
|
639
640
|
# times dict of the last 10 seconds (approximately) by diffing it with the current
|
|
640
641
|
# total response times. Then we'll use that to calculate a response time percentile
|
|
641
642
|
# for that timeframe
|
|
642
|
-
|
|
643
|
+
num_requests_in_window = (self.num_requests - self.num_none_requests) - (
|
|
644
|
+
cached.num_requests - cached.num_none_requests
|
|
645
|
+
)
|
|
646
|
+
percentile = calculate_response_time_percentile(
|
|
643
647
|
diff_response_time_dicts(self.response_times, cached.response_times),
|
|
644
|
-
|
|
648
|
+
num_requests_in_window,
|
|
645
649
|
percent,
|
|
646
650
|
)
|
|
651
|
+
# The window's own min and max aren't tracked, but its percentiles can't lie outside
|
|
652
|
+
# the overall ones. A window without requests keeps its 0.
|
|
653
|
+
return self._within_min_max_response_time(percentile) if num_requests_in_window > 0 else percentile
|
|
647
654
|
# if time was not in response times cache window
|
|
648
655
|
return None
|
|
649
656
|
|
|
@@ -240,19 +240,18 @@ class WebUI:
|
|
|
240
240
|
if user_class_name in form_data_user_class_names
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
+
elif self.environment.runner and self.environment.runner.state == STATE_RUNNING:
|
|
244
|
+
# Test is already running
|
|
245
|
+
# Using the user classes that have already been selected
|
|
246
|
+
user_classes = {
|
|
247
|
+
key: value
|
|
248
|
+
for (key, value) in self.environment.available_user_classes.items()
|
|
249
|
+
if value in self.environment.user_classes
|
|
250
|
+
}
|
|
243
251
|
else:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
user_classes = {
|
|
248
|
-
key: value
|
|
249
|
-
for (key, value) in self.environment.available_user_classes.items()
|
|
250
|
-
if value in self.environment.user_classes
|
|
251
|
-
}
|
|
252
|
-
else:
|
|
253
|
-
# Starting test with no user class selection
|
|
254
|
-
# Defaulting to using all available user classes
|
|
255
|
-
user_classes = self.environment.available_user_classes
|
|
252
|
+
# Starting test with no user class selection
|
|
253
|
+
# Defaulting to using all available user classes
|
|
254
|
+
user_classes = self.environment.available_user_classes
|
|
256
255
|
|
|
257
256
|
self._update_user_classes(user_classes)
|
|
258
257
|
|
|
@@ -87,7 +87,7 @@ test = [
|
|
|
87
87
|
]
|
|
88
88
|
lint = [
|
|
89
89
|
"pre-commit>=4.7.0,<5.0.0",
|
|
90
|
-
"ruff==0.17.
|
|
90
|
+
"ruff==0.17.5",
|
|
91
91
|
"mypy>=1.13.0,<1.15.0",
|
|
92
92
|
"types-requests==2.33.0.20260906",
|
|
93
93
|
"typos>=1.51.1"
|
|
@@ -169,7 +169,7 @@ extend-exclude = [
|
|
|
169
169
|
"examples/grpc/hello_pb2*.py",
|
|
170
170
|
]
|
|
171
171
|
lint.ignore = ["E402", "E501", "E713", "E731", "E741", "UP031", "PERF203", "RUF012", "RUF015"]
|
|
172
|
-
lint.select = ["E", "F", "W", "UP", "FA102", "I001", "FURB", "PERF", "RUF"]
|
|
172
|
+
lint.select = ["E", "F", "W", "UP", "FA102", "I001", "FURB", "PERF", "RUF", "PLE"]
|
|
173
173
|
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?)|resp)$"
|
|
174
174
|
|
|
175
175
|
[tool.ruff.lint.per-file-ignores]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|