locust 2.29.2.dev34__py3-none-any.whl → 2.29.2.dev45__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 +6 -2
- locust/contrib/fasthttp.py +1 -1
- locust/dispatch.py +7 -6
- locust/main.py +0 -1
- {locust-2.29.2.dev34.dist-info → locust-2.29.2.dev45.dist-info}/METADATA +31 -26
- locust-2.29.2.dev45.dist-info/RECORD +49 -0
- locust-2.29.2.dev45.dist-info/WHEEL +4 -0
- locust-2.29.2.dev45.dist-info/entry_points.txt +3 -0
- locust/test/__init__.py +0 -15
- locust/test/fake_module1_for_env_test.py +0 -7
- locust/test/fake_module2_for_env_test.py +0 -7
- locust/test/mock_locustfile.py +0 -56
- locust/test/mock_logging.py +0 -28
- locust/test/test_debugging.py +0 -39
- locust/test/test_dispatch.py +0 -4170
- locust/test/test_env.py +0 -283
- locust/test/test_fasthttp.py +0 -785
- locust/test/test_http.py +0 -325
- locust/test/test_interruptable_task.py +0 -48
- locust/test/test_load_locustfile.py +0 -228
- locust/test/test_locust_class.py +0 -831
- locust/test/test_log.py +0 -237
- locust/test/test_main.py +0 -2264
- locust/test/test_old_wait_api.py +0 -0
- locust/test/test_parser.py +0 -450
- locust/test/test_runners.py +0 -4476
- locust/test/test_sequential_taskset.py +0 -157
- locust/test/test_stats.py +0 -866
- locust/test/test_tags.py +0 -440
- locust/test/test_taskratio.py +0 -94
- locust/test/test_users.py +0 -69
- locust/test/test_util.py +0 -33
- locust/test/test_wait_time.py +0 -79
- locust/test/test_web.py +0 -1257
- locust/test/test_zmqrpc.py +0 -58
- locust/test/testcases.py +0 -248
- locust/test/util.py +0 -88
- locust-2.29.2.dev34.dist-info/RECORD +0 -79
- locust-2.29.2.dev34.dist-info/WHEEL +0 -5
- locust-2.29.2.dev34.dist-info/entry_points.txt +0 -2
- locust-2.29.2.dev34.dist-info/top_level.txt +0 -1
- {locust-2.29.2.dev34.dist-info → locust-2.29.2.dev45.dist-info}/LICENSE +0 -0
locust/_version.py
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
TYPE_CHECKING = False
|
4
4
|
if TYPE_CHECKING:
|
5
5
|
from typing import Tuple, Union
|
6
|
+
|
6
7
|
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
7
8
|
else:
|
8
9
|
VERSION_TUPLE = object
|
@@ -12,5 +13,8 @@ __version__: str
|
|
12
13
|
__version_tuple__: VERSION_TUPLE
|
13
14
|
version_tuple: VERSION_TUPLE
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
|
17
|
+
__version__ = "2.29.2.dev45"
|
18
|
+
version = __version__
|
19
|
+
__version_tuple__ = (2, 29, 2, "dev45")
|
20
|
+
version_tuple = __version_tuple__
|
locust/contrib/fasthttp.py
CHANGED
@@ -483,7 +483,7 @@ class FastResponse(CompatResponse):
|
|
483
483
|
|
484
484
|
_response: HTTPSocketPoolResponse | None = None
|
485
485
|
|
486
|
-
encoding: str | None = None
|
486
|
+
encoding: str | float | None = None
|
487
487
|
"""In some cases setting the encoding explicitly is needed. If so, do it before calling .text"""
|
488
488
|
|
489
489
|
request: FastRequest | None = None
|
locust/dispatch.py
CHANGED
@@ -90,13 +90,13 @@ class UsersDispatcher(Iterator):
|
|
90
90
|
assert len(user_classes) > 0
|
91
91
|
assert len(set(self._user_classes)) == len(self._user_classes)
|
92
92
|
|
93
|
-
self._target_user_count: int =
|
93
|
+
self._target_user_count: int = 0
|
94
94
|
|
95
|
-
self._spawn_rate: float =
|
95
|
+
self._spawn_rate: float = 0.0
|
96
96
|
|
97
|
-
self._user_count_per_dispatch_iteration: int =
|
97
|
+
self._user_count_per_dispatch_iteration: int = 0
|
98
98
|
|
99
|
-
self._wait_between_dispatch: float =
|
99
|
+
self._wait_between_dispatch: float = 0.0
|
100
100
|
|
101
101
|
self._initial_users_on_workers = {
|
102
102
|
worker_node.id: {user_class.__name__: 0 for user_class in self._user_classes}
|
@@ -107,7 +107,8 @@ class UsersDispatcher(Iterator):
|
|
107
107
|
|
108
108
|
self._current_user_count = self.get_current_user_count()
|
109
109
|
|
110
|
-
self._dispatcher_generator: Generator[dict[str, dict[str, int]], None, None] = None
|
110
|
+
self._dispatcher_generator: Generator[dict[str, dict[str, int]], None, None] = None # type: ignore
|
111
|
+
# a generator is assigned (in new_dispatch()) to _dispatcher_generator before it's used
|
111
112
|
|
112
113
|
self._user_generator = self._user_gen()
|
113
114
|
|
@@ -131,7 +132,7 @@ class UsersDispatcher(Iterator):
|
|
131
132
|
return sum(map(sum, map(dict.values, self._users_on_workers.values())))
|
132
133
|
|
133
134
|
@property
|
134
|
-
def dispatch_in_progress(self):
|
135
|
+
def dispatch_in_progress(self) -> bool:
|
135
136
|
return self._dispatch_in_progress
|
136
137
|
|
137
138
|
@property
|
locust/main.py
CHANGED
@@ -452,7 +452,6 @@ See https://github.com/locustio/locust/wiki/Installation#increasing-maximum-numb
|
|
452
452
|
|
453
453
|
# start Web UI
|
454
454
|
if not options.headless and not options.worker:
|
455
|
-
# spawn web greenlet
|
456
455
|
protocol = "https" if options.tls_cert and options.tls_key else "http"
|
457
456
|
|
458
457
|
if options.web_host == "*":
|
@@ -1,15 +1,15 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: locust
|
3
|
-
Version: 2.29.2.
|
3
|
+
Version: 2.29.2.dev45
|
4
4
|
Summary: Developer-friendly load testing framework
|
5
|
+
Home-page: https://locust.io/
|
5
6
|
License: MIT
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
Project-URL: Help/Questions, https://stackoverflow.com/questions/tagged/locust
|
10
|
-
Project-URL: Issue tracker, https://github.com/locustio/locust/issues
|
11
|
-
Classifier: Topic :: Software Development :: Testing :: Traffic Generation
|
7
|
+
Author: Jonatan Heyman
|
8
|
+
Maintainer: Lars Holmberg
|
9
|
+
Requires-Python: >=3.9
|
12
10
|
Classifier: Development Status :: 5 - Production/Stable
|
11
|
+
Classifier: Intended Audience :: Developers
|
12
|
+
Classifier: Intended Audience :: System Administrators
|
13
13
|
Classifier: License :: OSI Approved :: MIT License
|
14
14
|
Classifier: Operating System :: OS Independent
|
15
15
|
Classifier: Programming Language :: Python
|
@@ -18,29 +18,32 @@ Classifier: Programming Language :: Python :: 3.9
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.10
|
19
19
|
Classifier: Programming Language :: Python :: 3.11
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
21
|
-
Classifier: Intended Audience :: Developers
|
22
|
-
Classifier: Intended Audience :: System Administrators
|
23
21
|
Classifier: Topic :: Software Development :: Testing
|
24
22
|
Classifier: Topic :: Software Development :: Testing :: Traffic Generation
|
25
23
|
Classifier: Topic :: System :: Distributed Computing
|
26
|
-
Requires-
|
24
|
+
Requires-Dist: ConfigArgParse (>=1.5.5)
|
25
|
+
Requires-Dist: Flask-Cors (>=3.0.10)
|
26
|
+
Requires-Dist: Flask-Login (>=0.6.3)
|
27
|
+
Requires-Dist: Werkzeug (>=2.0.0)
|
28
|
+
Requires-Dist: flask (>=2.0.0)
|
29
|
+
Requires-Dist: gevent (>=22.10.2)
|
30
|
+
Requires-Dist: geventhttpclient (>=2.3.1)
|
31
|
+
Requires-Dist: msgpack (>=1.0.0)
|
32
|
+
Requires-Dist: psutil (>=5.9.1)
|
33
|
+
Requires-Dist: pywin32 ; sys_platform == "win32"
|
34
|
+
Requires-Dist: pyzmq (>=25.0.0)
|
35
|
+
Requires-Dist: requests (>=2.26.0) ; python_full_version <= "3.11.0"
|
36
|
+
Requires-Dist: requests (>=2.32.2) ; python_full_version > "3.11.0"
|
37
|
+
Requires-Dist: tomli (>=1.1.0) ; python_version < "3.11"
|
38
|
+
Requires-Dist: typing_extensions (>=4.6.0) ; python_version < "3.11"
|
39
|
+
Project-URL: Documentation, https://docs.locust.io/
|
40
|
+
Project-URL: Help/Questions, https://github.com/orgs/locustio/discussions/
|
41
|
+
Project-URL: Issue Tracker, https://github.com/locustio/locust/issues
|
42
|
+
Project-URL: Repository, https://github.com/locustio/locust
|
43
|
+
Project-URL: Stack Overflow, https://stackoverflow.com/questions/tagged/locust
|
44
|
+
Project-URL: Slack, https://locustio.slack.com/
|
45
|
+
Project-URL: Slack/Signup, https://communityinviter.com/apps/locustio/locust
|
27
46
|
Description-Content-Type: text/markdown
|
28
|
-
License-File: LICENSE
|
29
|
-
Requires-Dist: gevent >=22.10.2
|
30
|
-
Requires-Dist: flask >=2.0.0
|
31
|
-
Requires-Dist: Werkzeug >=2.0.0
|
32
|
-
Requires-Dist: requests >=2.26.0
|
33
|
-
Requires-Dist: msgpack >=1.0.0
|
34
|
-
Requires-Dist: pyzmq >=25.0.0
|
35
|
-
Requires-Dist: geventhttpclient >=2.3.1
|
36
|
-
Requires-Dist: ConfigArgParse >=1.5.5
|
37
|
-
Requires-Dist: psutil >=5.9.1
|
38
|
-
Requires-Dist: Flask-Login >=0.6.3
|
39
|
-
Requires-Dist: Flask-Cors >=3.0.10
|
40
|
-
Requires-Dist: pywin32 ; platform_system == "Windows"
|
41
|
-
Requires-Dist: tomli >=1.1.0 ; python_version < "3.11"
|
42
|
-
Requires-Dist: typing-extensions >=4.6.0 ; python_version < "3.11"
|
43
|
-
Requires-Dist: requests >=2.32.2 ; python_version > "3.11"
|
44
47
|
|
45
48
|
# Locust
|
46
49
|
|
@@ -112,6 +115,7 @@ Locust's code base is intentionally kept small and doesn't solve everything out
|
|
112
115
|
|
113
116
|
* Documentation: [docs.locust.io](https://docs.locust.io)
|
114
117
|
* Support/Questions: [StackOverflow](https://stackoverflow.com/questions/tagged/locust)
|
118
|
+
* Github Discussions: [Github Discussions](https://github.com/orgs/locustio/discussions)
|
115
119
|
* Chat/discussion: [Slack](https://locustio.slack.com) [(signup)](https://communityinviter.com/apps/locustio/locust)
|
116
120
|
|
117
121
|
## Authors
|
@@ -124,3 +128,4 @@ Locust's code base is intentionally kept small and doesn't solve everything out
|
|
124
128
|
## License
|
125
129
|
|
126
130
|
Open source licensed under the MIT license (see _LICENSE_ file for details).
|
131
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
locust/__init__.py,sha256=Hmw2vNf75eLQ1mQIPXAwlQrJ_XFY65MOb92fGsNCukQ,1458
|
2
|
+
locust/__main__.py,sha256=vBQ82334kX06ImDbFlPFgiBRiLIinwNk3z8Khs6hd74,31
|
3
|
+
locust/_version.py,sha256=wbJ33KlRaPlMmD35QMfvggNbfLmkO9fOXpA3osIknfo,460
|
4
|
+
locust/argument_parser.py,sha256=sjQoJ1NTac9LdNYT7zn8RajlWqBQs8YFNv6uRExb2gg,28941
|
5
|
+
locust/clients.py,sha256=OHPv6hBAt4gt3HI67yqyT1qrSsF8uMdCwIRu0kIsRWI,19491
|
6
|
+
locust/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
locust/contrib/fasthttp.py,sha256=1hR2WK-3ACGVsU6Fu4Z4KucVzL1LXMLG6k54KeZdt78,28509
|
8
|
+
locust/debug.py,sha256=We6Z9W0btkKSc7PxWmrZx-xMynvOOsKhG6jmDgQin0g,5134
|
9
|
+
locust/dispatch.py,sha256=0rGny9P8dEq2Kg7exRWPorKQ5D1LnhHd2xG5Jq7ge7g,17107
|
10
|
+
locust/env.py,sha256=sP-fCnZs0e2xodRemLHgTgyyUt5eezwtdA9WsCoqJkQ,12767
|
11
|
+
locust/event.py,sha256=iXEwIYFzra-j1WRldXB9SUibydtD8q8EIKaFPGTTIjk,8729
|
12
|
+
locust/exception.py,sha256=jGgJ32ubuf4pWdlaVOkbh2Y0LlG0_DHi-lv3ib8ppOE,1791
|
13
|
+
locust/html.py,sha256=_n3aB3fxiYzSeE_7RqHF3iiEPjPnbQ3e2Pw9P8AVtPU,3920
|
14
|
+
locust/input_events.py,sha256=ZIyePyAMuA_YFYWg18g_pE4kwuQV3RbEB250MzXRwjY,3314
|
15
|
+
locust/log.py,sha256=Wrkn0Ibugh5Sqjm4hGQ2-jUsy1tNMBdTctp4FyXQI24,3457
|
16
|
+
locust/main.py,sha256=XCB9Tm0JqDQ86xiEgPBDzziWGBEi0eHf0ghaJ32Ykt0,27825
|
17
|
+
locust/py.typed,sha256=gkWLl8yD4mIZnNYYAIRM8g9VarLvWmTAFeUfEbxJLBw,65
|
18
|
+
locust/rpc/__init__.py,sha256=nVGoHWFQxZjnhCDWjbgXIbmFbN9sizAjkhvSs9_642c,58
|
19
|
+
locust/rpc/protocol.py,sha256=n-rb3GZQcAlldYDj4E4GuFGylYj_26GSS5U29meft5Y,1282
|
20
|
+
locust/rpc/zmqrpc.py,sha256=AAY6w7wSFHsW34qqN28666boHFf6dTSAXPQJnAO6iUI,2707
|
21
|
+
locust/runners.py,sha256=otH-ZxTygBRXN46Nmocs5ac8R4b0MsnKAUcHRwVnD1E,69869
|
22
|
+
locust/shape.py,sha256=t-lwBS8LOjWcKXNL7j2U3zroIXJ1b0fazUwpRYQOKXw,1973
|
23
|
+
locust/stats.py,sha256=KLVIdw-jh09u75JFucl7PHXNktAnPnQx-DrV_rUH5xM,45772
|
24
|
+
locust/user/__init__.py,sha256=S2yvmI_AU9kXirtTIVqiV_Hs7yXzqXvaSgkNo9ig-fk,71
|
25
|
+
locust/user/inspectuser.py,sha256=KgrWHyE5jhK6or58R7soLRf-_st42AaQrR72qbiXw9E,2641
|
26
|
+
locust/user/sequential_taskset.py,sha256=SbrrGU9HV2nEWe6zQVtjymn8NgPISP7QSNoVdyoXjYg,2687
|
27
|
+
locust/user/task.py,sha256=doCOclhPC92ePfVa1KfIceZC-YofpnM4VaKplWYNH8o,16730
|
28
|
+
locust/user/users.py,sha256=BsKyxzLq1lmdYBXnwHNyMH_Nxfy7QRlyLnfiE8539HY,9989
|
29
|
+
locust/user/wait_time.py,sha256=bGRKMVx4lom75sX3POYJUa1CPeME2bEAXG6CEgxSO5U,2675
|
30
|
+
locust/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
|
+
locust/util/cache.py,sha256=IxbpGawl0-hoWKvCrtksxjSLf2GbBBTVns06F7mFBkM,1062
|
32
|
+
locust/util/date.py,sha256=pqyUuqzPds-A8ai6ZYTxe5Eak1M1BR9iuQcqEcrtHwc,179
|
33
|
+
locust/util/deprecation.py,sha256=pFipULkYFjYnuFSycJZ0s95r0CTSlvx8otGnqSu1bsQ,2028
|
34
|
+
locust/util/exception_handler.py,sha256=jTMyBq2a0O07fRjmqGkheyaPj58tUgnbbcjoesKGPws,797
|
35
|
+
locust/util/load_locustfile.py,sha256=hn70KcIG8jHmZyuKv2pcEmwgWtOEu24Efeji1KRYNUE,2964
|
36
|
+
locust/util/rounding.py,sha256=5haxR8mKhATqag6WvPby-MSRRgIw5Ob6thbyvMYZM7o,92
|
37
|
+
locust/util/timespan.py,sha256=Y0LtnhUq2Mq19p04u0XtBlYQ_-S2cRvwRdgru8W9WhA,986
|
38
|
+
locust/web.py,sha256=rN1NVeZ9LKSEeDwvpRbOJ0bcy8U1U4VjP-7vK7ejlwM,27367
|
39
|
+
locust/webui/dist/assets/favicon.ico,sha256=IUl-rYqfpHdV38e-s0bkmFIeLS-n3Ug0DQxk-h202hI,8348
|
40
|
+
locust/webui/dist/assets/index-e9ad42b4.js,sha256=aXKF6Qug5b9n5e160A0PFvM0qgJQgVwtwQhLwCsek-4,1647570
|
41
|
+
locust/webui/dist/assets/logo.png,sha256=EIVPqr6wE_yqguHaqFHIsH0ZACLSrvNWyYO7PbyIj4w,19299
|
42
|
+
locust/webui/dist/auth.html,sha256=NE_pYWbFjnBEkq2tG5mS_9YoL7JHX4Gkx9zhQoxlSC8,501
|
43
|
+
locust/webui/dist/index.html,sha256=S78UvAUZbQ-sH0wBxqFKrT2ZSfRxUFGx5xwQY6FaVMk,507
|
44
|
+
locust/webui/dist/report.html,sha256=sOdZZVgZbqgu86BBCSQf3uQUYXgmgSnXF32JpnyAII8,513
|
45
|
+
locust-2.29.2.dev45.dist-info/LICENSE,sha256=78XGpIn3fHVBfaxlPNUfjVufSN7QsdhpJMRJHv2AFpo,1095
|
46
|
+
locust-2.29.2.dev45.dist-info/METADATA,sha256=BHyeEeD6oiuZ5FGwhh4BTZI0H0IduWBpv0eXBOFwsIs,7674
|
47
|
+
locust-2.29.2.dev45.dist-info/WHEEL,sha256=HBsDV7Hj4OTiS1GX6ua7iQXUQTB9UHftbBxr7Q8Xm9c,110
|
48
|
+
locust-2.29.2.dev45.dist-info/entry_points.txt,sha256=RhIxlLwU_Ae_WjimS5COUDLagdCh6IOMyLtgaQxNmlM,43
|
49
|
+
locust-2.29.2.dev45.dist-info/RECORD,,
|
locust/test/__init__.py
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
try:
|
2
|
-
import resource
|
3
|
-
|
4
|
-
# work around occasional "zmq.error.ZMQError: Too many open files"
|
5
|
-
# this is done in main.py when running locust proper so we need to do it here as well
|
6
|
-
resource.setrlimit(
|
7
|
-
resource.RLIMIT_NOFILE,
|
8
|
-
(
|
9
|
-
10000,
|
10
|
-
resource.RLIM_INFINITY,
|
11
|
-
),
|
12
|
-
)
|
13
|
-
changed_rlimit = True
|
14
|
-
except Exception:
|
15
|
-
changed_rlimit = False
|
locust/test/mock_locustfile.py
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import random
|
3
|
-
import time
|
4
|
-
from contextlib import contextmanager
|
5
|
-
|
6
|
-
MOCK_LOCUSTFILE_CONTENT = '''
|
7
|
-
"""This is a mock locust file for unit testing"""
|
8
|
-
|
9
|
-
from locust import HttpUser, TaskSet, task, between, LoadTestShape
|
10
|
-
|
11
|
-
|
12
|
-
def index(l):
|
13
|
-
l.client.get("/")
|
14
|
-
|
15
|
-
def stats(l):
|
16
|
-
l.client.get("/stats/requests")
|
17
|
-
|
18
|
-
|
19
|
-
class UserTasks(TaskSet):
|
20
|
-
# one can specify tasks like this
|
21
|
-
tasks = [index, stats]
|
22
|
-
|
23
|
-
|
24
|
-
class UserSubclass(HttpUser):
|
25
|
-
host = "http://127.0.0.1:8089"
|
26
|
-
wait_time = between(2, 5)
|
27
|
-
tasks = [UserTasks]
|
28
|
-
|
29
|
-
|
30
|
-
class NotUserSubclass():
|
31
|
-
host = "http://localhost:8000"
|
32
|
-
|
33
|
-
'''
|
34
|
-
|
35
|
-
|
36
|
-
class MockedLocustfile:
|
37
|
-
__slots__ = ["filename", "directory", "file_path"]
|
38
|
-
|
39
|
-
|
40
|
-
@contextmanager
|
41
|
-
def mock_locustfile(filename_prefix="mock_locustfile", content=MOCK_LOCUSTFILE_CONTENT, dir=None):
|
42
|
-
mocked = MockedLocustfile()
|
43
|
-
mocked.directory = dir or os.path.dirname(os.path.abspath(__file__))
|
44
|
-
mocked.filename = "%s_%s_%i.py" % (
|
45
|
-
filename_prefix,
|
46
|
-
str(time.time()).replace(".", "_"),
|
47
|
-
random.randint(0, 100000),
|
48
|
-
)
|
49
|
-
mocked.file_path = os.path.join(mocked.directory, mocked.filename)
|
50
|
-
with open(mocked.file_path, "w") as file:
|
51
|
-
file.write(content)
|
52
|
-
|
53
|
-
try:
|
54
|
-
yield mocked
|
55
|
-
finally:
|
56
|
-
os.remove(mocked.file_path)
|
locust/test/mock_logging.py
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
import logging
|
4
|
-
from types import TracebackType
|
5
|
-
from typing import Union
|
6
|
-
|
7
|
-
LogMessage = list[Union[str, dict[str, TracebackType]]]
|
8
|
-
|
9
|
-
|
10
|
-
class MockedLoggingHandler(logging.Handler):
|
11
|
-
debug: list[LogMessage] = []
|
12
|
-
warning: list[LogMessage] = []
|
13
|
-
info: list[LogMessage] = []
|
14
|
-
error: list[LogMessage] = []
|
15
|
-
critical: list[LogMessage] = []
|
16
|
-
|
17
|
-
def emit(self, record):
|
18
|
-
if record.exc_info:
|
19
|
-
value = {"message": record.getMessage(), "exc_info": record.exc_info}
|
20
|
-
else:
|
21
|
-
value = record.getMessage()
|
22
|
-
getattr(self.__class__, record.levelname.lower()).append(value)
|
23
|
-
|
24
|
-
@classmethod
|
25
|
-
def reset(cls):
|
26
|
-
for attr in dir(cls):
|
27
|
-
if isinstance(getattr(cls, attr), list):
|
28
|
-
setattr(cls, attr, [])
|
locust/test/test_debugging.py
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
from locust import debug, task
|
2
|
-
from locust.test.testcases import LocustTestCase
|
3
|
-
from locust.user.task import LOCUST_STATE_STOPPING
|
4
|
-
from locust.user.users import HttpUser
|
5
|
-
|
6
|
-
import os
|
7
|
-
from threading import Timer
|
8
|
-
from unittest import mock
|
9
|
-
|
10
|
-
|
11
|
-
class DebugTestCase(LocustTestCase):
|
12
|
-
def setUp(self):
|
13
|
-
super().setUp()
|
14
|
-
debug._env = None
|
15
|
-
|
16
|
-
|
17
|
-
class TestDebugging(DebugTestCase):
|
18
|
-
@mock.patch.dict(os.environ, {"LOCUST_HOST": "http://localhost"})
|
19
|
-
def test_run_single_user_pass_host_to_user_classes(self):
|
20
|
-
"""
|
21
|
-
HttpUser should receive host from environment variable
|
22
|
-
"""
|
23
|
-
|
24
|
-
class MyUser1(HttpUser):
|
25
|
-
@task
|
26
|
-
def my_task(self):
|
27
|
-
pass
|
28
|
-
|
29
|
-
def _stop_user():
|
30
|
-
if user := getattr(debug._env, "single_user_instance", None):
|
31
|
-
user._state = LOCUST_STATE_STOPPING
|
32
|
-
|
33
|
-
t = Timer(1, _stop_user)
|
34
|
-
t.start()
|
35
|
-
|
36
|
-
debug.run_single_user(
|
37
|
-
MyUser1,
|
38
|
-
loglevel=None, # another log setup might mess with other tests...
|
39
|
-
)
|