Skip to content

Commit

Permalink
Slightly clarify test_start/test_stop examples
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberw committed Nov 30, 2020
1 parent deeac78 commit 12ff1d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/writing-a-locustfile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,11 @@ events. You can set up listeners for these events at the module level of your lo
from locust import events
@events.test_start.add_listener
def on_test_start(**kwargs):
def on_test_start(environment, **kwargs):
print("A new test is starting")
@events.test_stop.add_listener
def on_test_stop(**kwargs):
def on_test_stop(environment, **kwargs):
print("A new test is ending")
When running Locust distributed the ``test_start`` and ``test_stop`` events will only be fired in the master node.
Expand Down
2 changes: 1 addition & 1 deletion locust/test/test_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ def the_task(self):
test_start_run = [False]

@environment.events.test_start.add_listener
def on_test_start(**kw):
def on_test_start(_environment, **kw):
test_start_run[0] = True

worker = self.get_runner(environment=environment, user_classes=[MyTestUser])
Expand Down

0 comments on commit 12ff1d8

Please sign in to comment.