On an attempt to add a listener to test_start, I am met with module 'locust.events' has no attribute 'test_start'
Expected behavior
@events.test_start.add_listener
def on_test_start(**kwargs):
print("A new test is starting")
Should print "a new test is starting" when the test is ran
Actual behavior
locust-master_1 | [2020-07-10 14:49:00,185] 8821da7114b5/ERROR/stderr: Traceback (most recent call last):
locust-master_1 | [2020-07-10 14:49:00,185] 8821da7114b5/ERROR/stderr: File "/usr/local/bin/locust", line 8, in <module>
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr:
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr: sys.exit(main())
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr:
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr: File "/usr/local/lib/python3.7/site-packages/locust/main.py", line 420, in main
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr:
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr: docstring, locusts = load_locustfile(locustfile)
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr:
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr: File "/usr/local/lib/python3.7/site-packages/locust/main.py", line 389, in load_locustfile
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr:
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr: imported = __import_locustfile__(locustfile, path)
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr:
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr: File "/usr/local/lib/python3.7/site-packages/locust/main.py", line 365, in __import_locustfile__
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr:
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr: return source.load_module()
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr:
locust-master_1 | [2020-07-10 14:49:00,186] 8821da7114b5/ERROR/stderr: File "<frozen importlib._bootstrap_external>", line 407, in _check_name_wrapper
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr: File "<frozen importlib._bootstrap_external>", line 907, in load_module
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr: File "<frozen importlib._bootstrap_external>", line 732, in load_module
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr: File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr: File "<frozen importlib._bootstrap>", line 696, in _load
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr: File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr: File "<frozen importlib._bootstrap_external>", line 728, in exec_module
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr: File "/src/locustfile.py", line 54, in <module>
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr:
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr: @events.test_start.add_listener
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr:
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr: AttributeError
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr: :
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr: module 'locust.events' has no attribute 'test_start'
locust-master_1 | [2020-07-10 14:49:00,187] 8821da7114b5/ERROR/stderr:
project_locust-master_1 exited with code 0
Steps to reproduce
Run the below script
```
from locust import events
@events.test_start.add_listener
def on_test_start(**kwargs):
print("A new test is starting")
```
### Environment
- OS: Dockerized python 3.7
- Python version: 3.7
- Locust version: locustio==0.14.6
- Locust command line that you ran:
- Locust file contents (anonymized if necessary):
```
from locust import events
@events.test_start.add_listener
def on_test_start(**kwargs):
print("A new test is starting")
```
Describe the bug
On an attempt to add a listener to test_start, I am met with
module 'locust.events' has no attribute 'test_start'
Expected behavior
Should print "a new test is starting" when the test is ran
Actual behavior
Steps to reproduce
Run the below script ``` from locust import events @events.test_start.add_listener def on_test_start(**kwargs): print("A new test is starting") ``` ### Environment - OS: Dockerized python 3.7 - Python version: 3.7 - Locust version: locustio==0.14.6 - Locust command line that you ran: - Locust file contents (anonymized if necessary): ``` from locust import events @events.test_start.add_listener def on_test_start(**kwargs): print("A new test is starting") ```