From 18965d758db24e196968d76906f3be8621f81884 Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Mon, 21 Feb 2022 19:14:55 +0800 Subject: [PATCH] Fix typos --- README.md | 2 +- docs/quickstart.rst | 2 +- docs/running-in-debugger.rst | 4 ++-- locust/argument_parser.py | 2 +- locust/event.py | 2 +- locust/runners.py | 22 +++++++++++----------- locust/stats.py | 2 +- locust/test/test_main.py | 8 ++++---- locust/test/test_runners.py | 6 +++--- locust/user/users.py | 2 +- locust/web.py | 4 ++-- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 89932e7319..769fca979f 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Even though Locust primarily works with web sites/services, it can be used to te ## Hackable -Locust's code base is intentionally kept small and doesnt solve everything out of the box. Instead, we try to make it easy to adapt to any situation you may come across, using regular Python code. If you want to [send reporting data to that database & graphing system you like](https://github.com/SvenskaSpel/locust-plugins/blob/master/examples/timescale_listener_ex.py), [wrap calls to a REST API](https://github.com/SvenskaSpel/locust-plugins/blob/master/examples/rest_ex.py) to handle the particulars of your system or run a [totally custom load pattern](https://docs.locust.io/en/latest/custom-load-shape.html#custom-load-shape), there is nothing stopping you! +Locust's code base is intentionally kept small and doesn't solve everything out of the box. Instead, we try to make it easy to adapt to any situation you may come across, using regular Python code. If you want to [send reporting data to that database & graphing system you like](https://github.com/SvenskaSpel/locust-plugins/blob/master/examples/timescale_listener_ex.py), [wrap calls to a REST API](https://github.com/SvenskaSpel/locust-plugins/blob/master/examples/rest_ex.py) to handle the particulars of your system or run a [totally custom load pattern](https://docs.locust.io/en/latest/custom-load-shape.html#custom-load-shape), there is nothing stopping you! ## Links diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 8e6a83745f..49ba61052a 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -55,7 +55,7 @@ Number of users: .. note:: - Intepreting perfomance test results is quite complex (and mostly out of scope for this manual), but if your graphs start looking like this, the most likely reason is that your target service/system cannot handle the load you are hitting it with (it is overloaded or "saturated") + Interpreting performance test results is quite complex (and mostly out of scope for this manual), but if your graphs start looking like this, the most likely reason is that your target service/system cannot handle the load you are hitting it with (it is overloaded or "saturated") The clearest sign of this is that when we get to around 9 users, response times start increasing so fast that the requests per second-curve flattens out, even though new users are still being added. diff --git a/docs/running-in-debugger.rst b/docs/running-in-debugger.rst index a5b834865a..d9773ffbc3 100644 --- a/docs/running-in-debugger.rst +++ b/docs/running-in-debugger.rst @@ -6,14 +6,14 @@ Running tests in a debugger Running Locust in a debugger is extremely useful when developing your tests. Among other things, you can examine a particular response or check some User instance variable. -But debuggers sometimes have issues with complex gevent-applications like Locust, and there is a lot going on in the framework itself that you probably arent interested in. To simplify this, Locust provides a method called :py:func:`run_single_user `: +But debuggers sometimes have issues with complex gevent-applications like Locust, and there is a lot going on in the framework itself that you probably aren't interested in. To simplify this, Locust provides a method called :py:func:`run_single_user `: Note that this is fairly new feature, and the api is subject to change. .. literalinclude:: ../examples/debugging.py :language: python -It implicitly registeres an event handler for the :ref:`request ` event to print some stats about every request made: +It implicitly registers an event handler for the :ref:`request ` event to print some stats about every request made: .. code-block:: console diff --git a/locust/argument_parser.py b/locust/argument_parser.py index a40298d924..babc48e319 100644 --- a/locust/argument_parser.py +++ b/locust/argument_parser.py @@ -233,7 +233,7 @@ def setup_parser_arguments(parser): help="Quits Locust entirely, X seconds after the run is finished. Only used together with --autostart. The default is to keep Locust running until you shut it down using CTRL+C", env_var="LOCUST_AUTOQUIT", ) - # Override --headless parameter (useful because you cant disable a store_true-parameter like headless once it has been set in a config file) + # Override --headless parameter (useful because you can't disable a store_true-parameter like headless once it has been set in a config file) web_ui_group.add_argument( "--headful", action="store_true", diff --git a/locust/event.py b/locust/event.py index 6bacbe1c30..f369c7c9e4 100644 --- a/locust/event.py +++ b/locust/event.py @@ -194,7 +194,7 @@ class Events: """ def __init__(self): - # For backwarde compatiblilty use also values of class attributes + # For backwarde compatibility use also values of class attributes for name, value in vars(type(self)).items(): if value == EventHook: setattr(self, name, value()) diff --git a/locust/runners.py b/locust/runners.py index fabebed0cd..2410f42d2b 100644 --- a/locust/runners.py +++ b/locust/runners.py @@ -175,7 +175,7 @@ def user_classes_count(self) -> Dict[str, int]: # the supplied args are emptied whenever the greenlet is dead, so we can # simply ignore the greenlets with empty args. logger.debug( - "ERROR: While calculating number of running users, we encountered a user that didnt have proper args %s (user_greenlet.dead=%s)", + "ERROR: While calculating number of running users, we encountered a user that didn't have proper args %s (user_greenlet.dead=%s)", user_greenlet, user_greenlet.dead, ) @@ -247,7 +247,7 @@ def stop_users(self, user_classes_stop_count: Dict[str, int]): user = user_greenlet.args[0] except IndexError: logger.error( - "While stopping users, we encountered a user that didnt have proper args %s", user_greenlet + "While stopping users, we encountered a user that didn't have proper args %s", user_greenlet ) continue if isinstance(user, self.user_classes_by_name[user_class]): @@ -411,7 +411,7 @@ def shape_worker(self): # Because the first stage will take 100s to complete, the second stage # will be skipped completely because the shape worker will be blocked # at the `self.start()` of the first stage. - # Of couse, this isn't a problem if the load test shape is well-defined. + # Of course, this isn't a problem if the load test shape is well-defined. # We should probably use a `gevent.timeout` with a duration a little over # `(user_count - prev_user_count) / spawn_rate` in order to limit the runtime # of each load test shape stage. @@ -482,7 +482,7 @@ def __init__(self, environment): """ super().__init__(environment) - # register listener thats logs the exception for the local runner + # register listener that's logs the exception for the local runner def on_user_error(user_instance, exception, tb): formatted_tb = "".join(traceback.format_tb(tb)) self.log_exception("local", str(exception), formatted_tb) @@ -521,7 +521,7 @@ def send_message(self, msg_type, data=None): msg = Message(msg_type, data, "local") listener(environment=self.environment, msg=msg) else: - logger.warning(f"Unknown message type recieved: {msg_type}") + logger.warning(f"Unknown message type received: {msg_type}") class DistributedRunner(Runner): @@ -757,7 +757,7 @@ def start(self, user_count: int, spawn_rate: float, wait=False) -> None: gevent.sleep(0.01) except gevent.Timeout: msg_prefix = ( - "Spawning is complete and report waittime is expired, but not all reports recieved from workers" + "Spawning is complete and report waittime is expired, but not all reports received from workers" ) finally: timeout.cancel() @@ -975,10 +975,10 @@ def client_listener(self): elif msg.type == "exception": self.log_exception(msg.node_id, msg.data["msg"], msg.data["traceback"]) elif msg.type in self.custom_messages: - logger.debug(f"Recieved {msg.type} message from worker {msg.node_id}") + logger.debug(f"Received {msg.type} message from worker {msg.node_id}") self.custom_messages[msg.type](environment=self.environment, msg=msg) else: - logger.warning(f"Unknown message type recieved from worker {msg.node_id}: {msg.type}") + logger.warning(f"Unknown message type received from worker {msg.node_id}: {msg.type}") self.check_stopped() @@ -1067,7 +1067,7 @@ def on_quitting(environment, **kw): self.environment.events.quitting.add_listener(on_quitting) - # register listener thats sends user exceptions to master + # register listener that's sends user exceptions to master def on_user_error(user_instance, exception, tb): formatted_tb = "".join(traceback.format_tb(tb)) self.client.send(Message("exception", {"msg": str(exception), "traceback": formatted_tb}, self.client_id)) @@ -1196,10 +1196,10 @@ def worker(self): self._send_stats() # send a final report, in case there were any samples not yet reported self.greenlet.kill(block=True) elif msg.type in self.custom_messages: - logger.debug(f"Recieved {msg.type} message from master") + logger.debug(f"Received {msg.type} message from master") self.custom_messages[msg.type](environment=self.environment, msg=msg) else: - logger.warning(f"Unknown message type recieved: {msg.type}") + logger.warning(f"Unknown message type received: {msg.type}") def stats_reporter(self): while True: diff --git a/locust/stats.py b/locust/stats.py index 04c5aa43b2..e565f8937b 100644 --- a/locust/stats.py +++ b/locust/stats.py @@ -36,7 +36,7 @@ def resize_handler(signum, frame): try: signal.signal(signal.SIGWINCH, resize_handler) except AttributeError: - pass # Windows doesnt have SIGWINCH + pass # Windows doesn't have SIGWINCH STATS_TYPE_WIDTH = 8 diff --git a/locust/test/test_main.py b/locust/test/test_main.py index 9dc6b5f403..e34a77e039 100644 --- a/locust/test/test_main.py +++ b/locust/test/test_main.py @@ -432,7 +432,7 @@ def test_autostart_wo_run_time(self): self.assertIn("No run time limit set, use CTRL+C to interrupt", stderr) self.assertIn("Shutting down ", stderr) self.assertNotIn("Traceback", stderr) - # check response afterwards, because it really isnt as informative as stderr + # check response afterwards, because it really isn't as informative as stderr self.assertEqual(200, response.status_code) self.assertIn('', response.text) @@ -466,7 +466,7 @@ def test_autostart_w_run_time(self): self.assertIn("Run time limit set to 2 seconds", stderr) self.assertIn("Shutting down ", stderr) self.assertNotIn("Traceback", stderr) - # check response afterwards, because it really isnt as informative as stderr + # check response afterwards, because it really isn't as informative as stderr self.assertEqual(200, response.status_code) self.assertIn('', response.text) @@ -516,7 +516,7 @@ def tick(self): self.assertIn("Shape test starting", stderr) self.assertIn("Shutting down ", stderr) self.assertIn("autoquit time reached", stderr) - # check response afterwards, because it really isnt as informative as stderr + # check response afterwards, because it really isn't as informative as stderr self.assertEqual(200, response.status_code) self.assertIn('', response.text) self.assertTrue(success, "got timeout and had to kill the process") @@ -987,7 +987,7 @@ def t(self): proc_worker.communicate() self.assertIn( - 'Spawning is complete and report waittime is expired, but not all reports recieved from workers: {"User1": 2} (2 total users)', + 'Spawning is complete and report waittime is expired, but not all reports received from workers: {"User1": 2} (2 total users)', stdout, ) self.assertIn("Shutting down (exit code 0)", stdout) diff --git a/locust/test/test_runners.py b/locust/test/test_runners.py index 8236f17b5d..b91b774a92 100644 --- a/locust/test/test_runners.py +++ b/locust/test/test_runners.py @@ -553,7 +553,7 @@ def on_custom_msg(msg, **kw): self.assertFalse(test_custom_msg[0]) self.assertEqual(1, len(self.mocked_log.warning)) msg = self.mocked_log.warning[0] - self.assertIn("Unknown message type recieved", msg) + self.assertIn("Unknown message type received", msg) def test_swarm_endpoint_is_non_blocking(self): class TestUser1(User): @@ -2605,7 +2605,7 @@ def on_custom_msg(msg, **kw): self.assertFalse(test_custom_msg[0]) self.assertEqual(1, len(self.mocked_log.warning)) msg = self.mocked_log.warning[0] - self.assertIn("Unknown message type recieved from worker", msg) + self.assertIn("Unknown message type received from worker", msg) def test_wait_for_workers_report_after_ramp_up(self): def assert_cache_hits(): @@ -3087,7 +3087,7 @@ def on_custom_msg(msg, **kw): self.assertFalse(test_custom_msg[0]) self.assertEqual(1, len(self.mocked_log.warning)) msg = self.mocked_log.warning[0] - self.assertIn("Unknown message type recieved", msg) + self.assertIn("Unknown message type received", msg) def test_start_event(self): class MyTestUser(User): diff --git a/locust/user/users.py b/locust/user/users.py index 1852c91ef5..96082f4edf 100644 --- a/locust/user/users.py +++ b/locust/user/users.py @@ -100,7 +100,7 @@ class ForumPage(TaskSet): fixed_count = 0 """ If the value > 0, the weight property will be ignored and the 'fixed_count'-instances will be spawned. - These Users are spawned first. If the total target count (specified by the --users arg) is not enougth + These Users are spawned first. If the total target count (specified by the --users arg) is not enough to spawn all instances of each User class with the defined property, the final count of each User is undefined. """ diff --git a/locust/web.py b/locust/web.py index 3e748b92b6..36471ff306 100644 --- a/locust/web.py +++ b/locust/web.py @@ -142,7 +142,7 @@ def swarm(): parsed_options_dict = vars(environment.parsed_options) if environment.parsed_options else {} for key, value in request.form.items(): - if key == "user_count": # if we just renamed this field to "users" we wouldnt need this + if key == "user_count": # if we just renamed this field to "users" we wouldn't need this user_count = int(value) elif key == "spawn_rate": spawn_rate = float(value) @@ -151,7 +151,7 @@ def swarm(): environment.host = str(request.form["host"]).replace("<", "").replace(">", "") elif key in parsed_options_dict: # update the value in environment.parsed_options, but dont change the type. - # This wont work for parameters that are None + # This won't work for parameters that are None parsed_options_dict[key] = type(parsed_options_dict[key])(value) if environment.shape_class: