locust 2.20.0__py3-none-any.whl → 2.20.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.

Potentially problematic release.


This version of locust might be problematic. Click here for more details.

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.20.0'
16
- __version_tuple__ = version_tuple = (2, 20, 0)
15
+ __version__ = version = '2.20.1'
16
+ __version_tuple__ = version_tuple = (2, 20, 1)
locust/argument_parser.py CHANGED
@@ -355,7 +355,7 @@ def setup_parser_arguments(parser):
355
355
  dest="web_auth",
356
356
  metavar="<username:password>",
357
357
  default=None,
358
- help="DEPRECATED Turn on Basic Auth for the web interface. Should be supplied in the following format: username:password",
358
+ help="DEPRECATED. See https://github.com/locustio/locust/issues/2517 Turn on Basic Auth for the web interface. Should be supplied in the following format: username:password ",
359
359
  env_var="LOCUST_WEB_AUTH",
360
360
  )
361
361
  web_ui_group.add_argument(
locust/debug.py CHANGED
@@ -2,6 +2,7 @@ from datetime import datetime, timezone
2
2
  import os
3
3
  import inspect
4
4
  import locust
5
+ import locust.log
5
6
  from locust import User, argument_parser
6
7
  from typing import Type, Optional
7
8
  from locust.env import Environment
@@ -102,7 +103,7 @@ def run_single_user(
102
103
  include_time=False,
103
104
  include_context=False,
104
105
  include_payload=False,
105
- loglevel=None,
106
+ loglevel: Optional[str] = "WARNING",
106
107
  ):
107
108
  """
108
109
  Runs a single User. Useful when you want to run a debugger.
@@ -113,8 +114,8 @@ def run_single_user(
113
114
 
114
115
  It prints some info about every request to stdout, and you can get additional info using the `include_*` flags
115
116
 
116
- By default, it does not set up locusts logging system (because it could interfere with the printing of requests),
117
- but you can change that by passing a log level (e.g. *loglevel="INFO"*)
117
+ It also initiates logging on WARNING level (not INFO, because it could interfere with the printing of requests),
118
+ but you can change that by passing a log level (or disabling logging entirely by passing None)
118
119
  """
119
120
  global _env
120
121
 
@@ -141,6 +142,9 @@ def run_single_user(
141
142
  )
142
143
  # fire various events (quit and test_stop will never get called, sorry about that)
143
144
  _env.events.init.fire(environment=_env, runner=None, web_ui=None)
145
+ # uncaught events will be suppressed, so check if that happened
146
+ if locust.log.unhandled_greenlet_exception:
147
+ raise Exception("Unhandled exception in init")
144
148
 
145
149
  # do the things that the Runner usually does
146
150
  _env.user_classes = [user_class]
locust/event.py CHANGED
@@ -55,7 +55,12 @@ class EventHook:
55
55
  ) -> Generator[Dict[str, Any], None, None]:
56
56
  """Convenience method for firing the event with automatically calculated response time and automatically marking the request as failed if an exception is raised (this is really only useful for the *request* event)
57
57
 
58
- Other attributes in the event can be added/updated inside your with block if you use the "with ... as request_meta:" syntax.
58
+ Example usage (in a task):
59
+
60
+ with self.environment.events.request.measure("myrequestType", "myRequestName") as request_meta:
61
+ # do the stuff you want to measure
62
+
63
+ You can optionally add/overwrite entries in the request_meta dict and they will be passed to the request event.
59
64
 
60
65
  Experimental.
61
66
  """
@@ -91,7 +96,7 @@ class DeprecatedEventHook(EventHook):
91
96
  class Events:
92
97
  request: EventHook
93
98
  """
94
- Fired when a request in completed, successful or unsuccessful. This event is typically used to report requests when writing custom clients for locust.
99
+ Fired when a request in completed.
95
100
 
96
101
  Event arguments:
97
102
 
@@ -102,6 +107,8 @@ class Events:
102
107
  :param response: Response object (e.g. a :py:class:`requests.Response`)
103
108
  :param context: :ref:`User/request context <request_context>`
104
109
  :param exception: Exception instance that was thrown. None if request was successful.
110
+
111
+ If you want to simplify a custom client, you can have Locust measure the time for you by using :meth:`measure() <locust.event.EventHook.measure>`
105
112
  """
106
113
 
107
114
  user_error: EventHook
locust/main.py CHANGED
@@ -428,7 +428,9 @@ See https://github.com/locustio/locust/wiki/Installation#increasing-maximum-numb
428
428
  else:
429
429
  logger.info(f"Starting web interface at {protocol}://0.0.0.0:{options.web_port}")
430
430
  if options.web_auth:
431
- logging.info("BasicAuth support is deprecated, it will be removed in a future release.")
431
+ logging.warning(
432
+ "BasicAuth support is deprecated, it will be removed in a future release, unless someone reimplements it in a more modern way! See https://github.com/locustio/locust/issues/2517"
433
+ )
432
434
  web_ui = environment.create_web_ui(
433
435
  host=web_host,
434
436
  port=options.web_port,
locust/rpc/zmqrpc.py CHANGED
@@ -13,6 +13,7 @@ class BaseSocket:
13
13
 
14
14
  self.socket.setsockopt(zmq.TCP_KEEPALIVE, 1)
15
15
  self.socket.setsockopt(zmq.TCP_KEEPALIVE_IDLE, 30)
16
+ self.socket.setsockopt(zmq.IPV6, 1)
16
17
 
17
18
  @retry()
18
19
  def send(self, msg):
@@ -23,7 +23,7 @@ class TestDebugging(DebugTestCase):
23
23
 
24
24
  class MyUser1(HttpUser):
25
25
  @task
26
- def my_task():
26
+ def my_task(self):
27
27
  pass
28
28
 
29
29
  def _stop_user():
@@ -34,4 +34,7 @@ class TestDebugging(DebugTestCase):
34
34
  t = Timer(1, _stop_user)
35
35
  t.start()
36
36
 
37
- debug.run_single_user(MyUser1)
37
+ debug.run_single_user(
38
+ MyUser1,
39
+ loglevel=None, # another log setup might mess with other tests...
40
+ )
@@ -8,7 +8,7 @@ from locust.exception import RPCError, RPCSendError, RPCReceiveError
8
8
  class ZMQRPC_tests(LocustTestCase):
9
9
  def setUp(self):
10
10
  super().setUp()
11
- self.server = zmqrpc.Server("127.0.0.1", 0)
11
+ self.server = zmqrpc.Server("*", 0)
12
12
  self.client = zmqrpc.Client("localhost", self.server.port, "identity")
13
13
 
14
14
  def tearDown(self):
@@ -19,8 +19,10 @@ class ZMQRPC_tests(LocustTestCase):
19
19
  def test_constructor(self):
20
20
  self.assertEqual(self.server.socket.getsockopt(zmq.TCP_KEEPALIVE), 1)
21
21
  self.assertEqual(self.server.socket.getsockopt(zmq.TCP_KEEPALIVE_IDLE), 30)
22
+ self.assertEqual(self.server.socket.getsockopt(zmq.IPV6), 1)
22
23
  self.assertEqual(self.client.socket.getsockopt(zmq.TCP_KEEPALIVE), 1)
23
24
  self.assertEqual(self.client.socket.getsockopt(zmq.TCP_KEEPALIVE_IDLE), 30)
25
+ self.assertEqual(self.client.socket.getsockopt(zmq.IPV6), 1)
24
26
 
25
27
  def test_client_send(self):
26
28
  self.client.send(Message("test", "message", "identity"))
@@ -40,15 +42,15 @@ class ZMQRPC_tests(LocustTestCase):
40
42
  self.assertEqual(msg.node_id, "identity")
41
43
 
42
44
  def test_client_retry(self):
43
- server = zmqrpc.Server("127.0.0.1", 0)
45
+ server = zmqrpc.Server("*", 0)
44
46
  server.socket.close()
45
47
  with self.assertRaises(RPCError):
46
48
  server.recv_from_client()
47
49
 
48
50
  def test_rpc_error(self):
49
- server = zmqrpc.Server("127.0.0.1", 0)
51
+ server = zmqrpc.Server("*", 0)
50
52
  with self.assertRaises(RPCError):
51
- server = zmqrpc.Server("127.0.0.1", server.port)
53
+ server = zmqrpc.Server("*", server.port)
52
54
  server.close()
53
55
  with self.assertRaises(RPCSendError):
54
56
  server.send_to_client(Message("test", "message", "identity"))
locust/user/task.py CHANGED
@@ -88,7 +88,7 @@ def task(weight: TaskT | int = 1) -> TaskT | Callable[[TaskT], TaskT]:
88
88
  Check if task was used without parentheses (not called), like this::
89
89
 
90
90
  @task
91
- def my_task()
91
+ def my_task(self)
92
92
  pass
93
93
  """
94
94
  if callable(weight):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: locust
3
- Version: 2.20.0
3
+ Version: 2.20.1
4
4
  Summary: Developer friendly load testing framework
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://locust.io/
@@ -30,7 +30,7 @@ License-File: LICENSE
30
30
  Requires-Dist: gevent >=22.10.2
31
31
  Requires-Dist: flask >=2.0.0
32
32
  Requires-Dist: Werkzeug >=2.0.0
33
- Requires-Dist: requests >=2.23.0
33
+ Requires-Dist: requests >=2.26.0
34
34
  Requires-Dist: msgpack >=1.0.0
35
35
  Requires-Dist: pyzmq >=25.0.0
36
36
  Requires-Dist: geventhttpclient >=2.0.11
@@ -45,12 +45,16 @@ Requires-Dist: pywin32 ; platform_system == "Windows"
45
45
 
46
46
  [![PyPI](https://img.shields.io/pypi/v/locust.svg)](https://pypi.org/project/locust/)
47
47
  [![PyPI](https://img.shields.io/pypi/pyversions/locust.svg)](https://pypi.org/project/locust/)
48
+ [![Downloads](https://pepy.tech/badge/locust/week)](https://pepy.tech/project/locust)
48
49
  [![Build Status](https://github.com/locustio/locust/workflows/Tests/badge.svg)](https://github.com/locustio/locust/actions?query=workflow%3ATests)
49
- [![license](https://img.shields.io/github/license/locustio/locust.svg)](https://github.com/locustio/locust/blob/master/LICENSE)
50
50
  [![GitHub contributors](https://img.shields.io/github/contributors/locustio/locust.svg)](https://github.com/locustio/locust/graphs/contributors)
51
51
  [![Support Ukraine Badge](https://bit.ly/support-ukraine-now)](https://github.com/support-ukraine/support-ukraine)
52
52
 
53
- Locust is an easy to use, scriptable and scalable performance testing tool. You define your load test in regular Python code, instead of being constrained by a UI or domain specific language that only pretends to be real code. This makes Locust infinitely expandable and very developer friendly.
53
+ Locust is an open source performance/load testing tool for HTTP and other protocols. Its developer friendly approach lets you to define your tests in regular Python code.
54
+
55
+ Locust tests can be run from command line or using its web-based UI. Throughput, response times and errors can be viewed in real time and/or exported for later analysis.
56
+
57
+ You can import regular Python libraries into your tests, and with Locust's pluggable architecture it is infinitely expandable. Unlike when using most other tools, your test design will never be limited by a GUI or domain-specific language.
54
58
 
55
59
  To get started right away, head over to the [documentation](http://docs.locust.io/en/stable/installation.html).
56
60
 
@@ -1,17 +1,17 @@
1
1
  locust/__init__.py,sha256=Q6sqz7YDUaMKPEqcDjWcXEFG2ilVRQR7kl0fG0yK_5A,1402
2
2
  locust/__main__.py,sha256=vBQ82334kX06ImDbFlPFgiBRiLIinwNk3z8Khs6hd74,31
3
- locust/_version.py,sha256=06rDmnBueRSgi5xMbJeJJv4Inf7i7qfZ2JToAUH8pTU,413
4
- locust/argument_parser.py,sha256=H2tzJLu1F3oxxYkXLRUT6GtpV5UG5aGTcPWI3XwE4-c,26365
3
+ locust/_version.py,sha256=O_9E_1sV6go84VUte56oNsLchT6VjfhXsbplO2mVbJY,413
4
+ locust/argument_parser.py,sha256=eCJM29OX7NcMROfNSxQm0uyNcEtml6Rj202t51TlovE,26418
5
5
  locust/clients.py,sha256=GJXTWcyBAepE6O-o-V92WboV8XKOXxWR-AixlcL74_w,14768
6
- locust/debug.py,sha256=pEnZ74679vCdDODEMTNvjYcVdWCe4sWolHDJvdXh9dU,4818
6
+ locust/debug.py,sha256=Rq0Wjs0esvjevAiUb04QhkLeClldwFvm5cj0aDl40dE,5063
7
7
  locust/dispatch.py,sha256=nVWXBkUzpqsVeVp5sw3sYSjR1dD5AAUiFLqutqsrlm4,18634
8
8
  locust/env.py,sha256=RntbYEcxP95Lrv80silTHI9qBthjdgz7OYH_HiM6s7U,11429
9
- locust/event.py,sha256=On9fb-FL9GxTDsgd8yApUoPoe2fShyPm2a3_9JrrobA,7453
9
+ locust/event.py,sha256=5NmOGPuYP89Wz8UjF9QRVx4N8GPuAlOrbtQWOLBmTH8,7671
10
10
  locust/exception.py,sha256=aGCx5TQmkYZn8P_uDD3Z4ZwxxRoA7R3ml0WJO-nHgFQ,1942
11
11
  locust/html.py,sha256=2mp33VdzqYHaugas3nGtW-ypWRLzGyhPYwin6HFkA98,5717
12
12
  locust/input_events.py,sha256=ARmzf5K_t4OnsNilkx0adDnNqvU9-NxtQvKOOjwgA_A,3048
13
13
  locust/log.py,sha256=2IVp9YL4ZPfWdj3sBFuOHfgneg3g7m7tUGR-sy2s3E8,3155
14
- locust/main.py,sha256=Kf9zoml_ZpRdTSgSA9-wtzJtcSzTZw-T0YIwV_Lgf50,27009
14
+ locust/main.py,sha256=1W_omId9MMARONGmo08BfIIKvutdDuDWL5VfV9SijgM,27154
15
15
  locust/py.typed,sha256=gkWLl8yD4mIZnNYYAIRM8g9VarLvWmTAFeUfEbxJLBw,65
16
16
  locust/runners.py,sha256=C1Lxdc3mZbomJcwt7OPCRdHXECvinJJ8I4wsfh7o_6g,65805
17
17
  locust/shape.py,sha256=SrKDabGtZ5bqMopJDdivvLbPencaYfAPUv1qzQiAgiA,1969
@@ -21,7 +21,7 @@ locust/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  locust/contrib/fasthttp.py,sha256=qAEW7EwLot605rm1irLSuGA3TixvfioNYnKsq2PolWY,26534
22
22
  locust/rpc/__init__.py,sha256=nVGoHWFQxZjnhCDWjbgXIbmFbN9sizAjkhvSs9_642c,58
23
23
  locust/rpc/protocol.py,sha256=AGFtveF7-_i5ipsRYhT-ily4blxnjZ3FXeIL6ZabO4c,1285
24
- locust/rpc/zmqrpc.py,sha256=zG6hli3RouftrI28XqAlHtZ-UUSM9Wn41HkY9cKgAU4,2591
24
+ locust/rpc/zmqrpc.py,sha256=r4k7ALZwBUHcPuFbfa3nYf-zsi8Gfaj8jHnrk4zfmgc,2635
25
25
  locust/static/chart.js,sha256=Aue4SxJZhv9I3k0Nr2uXTrdrLxsrX7x_a0d4u3a1e_Q,4796
26
26
  locust/static/echarts.common.min.js,sha256=2h6zIZeHk-eGAiC-qYvxv7uW5S1HcyM72K5FbcVhky4,620458
27
27
  locust/static/jquery-1.11.3.min.js,sha256=7LkWEzqTdpEfELxcZZlS6wAx5Ff13zZ83lYO2_ujj7g,95957
@@ -52,7 +52,7 @@ locust/test/fake_module1_for_env_test.py,sha256=dzGYWCr1SSkd8Yyo68paUNrCNW7YY_Qg
52
52
  locust/test/fake_module2_for_env_test.py,sha256=dzGYWCr1SSkd8Yyo68paUNrCNW7YY_QgjRb7sM37gG0,164
53
53
  locust/test/mock_locustfile.py,sha256=N9sGjW-BmJ-J_x-5bEOR82VQ0DhR1hki313BHPOWq4g,1273
54
54
  locust/test/mock_logging.py,sha256=9KC_YXa0DvF44lvpDnWhjV0GLrtwtt2SxZIzM6sJGzU,783
55
- locust/test/test_debugging.py,sha256=_2by3ejG4Ujx8tz3-OOXiRBJzjwouS-jznKg5MZuGvk,963
55
+ locust/test/test_debugging.py,sha256=b-ekJpcwVWYlmIizdZYpbk1RMzrWPilM_iyzhb9tMvc,1069
56
56
  locust/test/test_dispatch.py,sha256=z94qj0exsIqtPl_TAx3vvBGxVBQoLovWcUPQfNulVO8,166172
57
57
  locust/test/test_env.py,sha256=Mp3EKVAjC84j57_yp7Gq67Q5TFyEOSQJ-mZyis_vt1c,6126
58
58
  locust/test/test_fasthttp.py,sha256=IIwyIIQIk8o_Hkyhg55Ff6NHF3hwXRBQJdhxNM8oEns,29886
@@ -73,13 +73,13 @@ locust/test/test_users.py,sha256=MErMCsEsHNALBj-GHcWjhZW5oMIoE4mbQW9dWqDHDQc,213
73
73
  locust/test/test_util.py,sha256=-wwdxyf1sqKVV_R2wDFZlp56ghBDkbS-leBEfjhxbMQ,1228
74
74
  locust/test/test_wait_time.py,sha256=9Qw48gGuJYpeb_0lr-bwuH3TjA4v2UQ1yDPZfUAjXX0,2353
75
75
  locust/test/test_web.py,sha256=I5Knomt9JQ1YSdiO2dyfVUDFkhOCuVey_R9_J0Qoy-s,48092
76
- locust/test/test_zmqrpc.py,sha256=JQ0iYWJoQb2JeS6EMvh_sOaG_sNjjXfT4V5RfsRnxlQ,2065
76
+ locust/test/test_zmqrpc.py,sha256=ETSahaxHG5snJAeTqQevPc9tuqpmOMBaKpZxPfwxh_I,2171
77
77
  locust/test/testcases.py,sha256=DkrP1mV5DX42kruPxAVj-dGLXq-XAy3WtEslDE69vlA,6979
78
78
  locust/test/util.py,sha256=LmxhmhLeXlsHnj1fPyesunHz5yqC9o0-UqOug5VBw14,2667
79
79
  locust/user/__init__.py,sha256=u5wggKl1tLRFlO66xbyVoQAHrbRRfEE7bFuY1AmUZOY,71
80
80
  locust/user/inspectuser.py,sha256=oKJEVWrFtNaPsZJRaNm3gbR0LyjVYPHtnrHjgtdJU1w,2641
81
81
  locust/user/sequential_taskset.py,sha256=6oaUz64xS13cpAgO--HxeMgn2N98DPpylUHqJ8H1v80,2542
82
- locust/user/task.py,sha256=cGlBXak2pqwHs_DDy-ehjTcwHaAFxP7uR8v05NQGNQ0,16780
82
+ locust/user/task.py,sha256=ER73Ai2IJ50eQZxb0u8ziLAFiQ3QqYwFIaIjDJpGc58,16784
83
83
  locust/user/users.py,sha256=lZtUojQoimuIh2hqEnf9clj58U22n7OnpiCYzDu_dtw,9737
84
84
  locust/user/wait_time.py,sha256=bGRKMVx4lom75sX3POYJUa1CPeME2bEAXG6CEgxSO5U,2675
85
85
  locust/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -94,9 +94,9 @@ locust/webui/dist/report.html,sha256=Vyi9LIAjBNiAsvn6LVFkdAZ9R4Fa8UjHnqscjAeOFp8
94
94
  locust/webui/dist/assets/favicon.ico,sha256=IUl-rYqfpHdV38e-s0bkmFIeLS-n3Ug0DQxk-h202hI,8348
95
95
  locust/webui/dist/assets/index-01afe4fa.js,sha256=uXPULlueC1FWZnTAMk7oA0wCSeY7xtNbxxycrIVvEGQ,1627703
96
96
  locust/webui/dist/assets/logo.png,sha256=lPCYhpDsPXYY3gUMlq3bzABI5WBtdBOvtay8R9hRFv4,2943
97
- locust-2.20.0.dist-info/LICENSE,sha256=78XGpIn3fHVBfaxlPNUfjVufSN7QsdhpJMRJHv2AFpo,1095
98
- locust-2.20.0.dist-info/METADATA,sha256=AoFzNr5VqIAiqzOwkW0SdsOBCNFvG6Cwxi1ZRWn6nNE,7144
99
- locust-2.20.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
100
- locust-2.20.0.dist-info/entry_points.txt,sha256=RAdt8Ku-56m7bFjmdj-MBhbF6h4NX7tVODR9QNnOg0E,44
101
- locust-2.20.0.dist-info/top_level.txt,sha256=XSsjgPA8Ggf9TqKVbkwSqZFuPlZ085X13M9orDycE20,7
102
- locust-2.20.0.dist-info/RECORD,,
97
+ locust-2.20.1.dist-info/LICENSE,sha256=78XGpIn3fHVBfaxlPNUfjVufSN7QsdhpJMRJHv2AFpo,1095
98
+ locust-2.20.1.dist-info/METADATA,sha256=JNOQAAmR_mugbDsx4rBpOOPk2UveTUAz1fwJzVBcJyo,7389
99
+ locust-2.20.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
100
+ locust-2.20.1.dist-info/entry_points.txt,sha256=RAdt8Ku-56m7bFjmdj-MBhbF6h4NX7tVODR9QNnOg0E,44
101
+ locust-2.20.1.dist-info/top_level.txt,sha256=XSsjgPA8Ggf9TqKVbkwSqZFuPlZ085X13M9orDycE20,7
102
+ locust-2.20.1.dist-info/RECORD,,