-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--run-time flag is not respected if there is an exception in a test_stop listener #1461
Comments
I added some simple exception handling to fix my issue in #1462, but I am not sure if that's the preferred way of handling this (for example, there is no logging of the exception) |
Awesome, thanks!
with
|
Thanks @cyberw!, I saw that the test coverage was reduced by this change, in which file do you recommend I write a test for this? |
👍 I think it belongs in a completely new file called test_event.py. |
Actually, changed my mind, put it in test_runners.py. The other test_stop/start tests are there, and I'm a fan of testing slightly bigger things (runner+event instead of just event) when possible. |
Oh, and one more thing: I think an exception in one of the event methods should set the return code of locust to fail. Import and set log.unhandled_greenlet_exception to True, it is close enough to what has happened, and will be checked when Locust is shutting down. |
neat! thanks for all the help, I just pushed new changes, please let me know if you have any other suggestions. |
LGTM :) Thanks! |
Describe the bug
On a headless session, if there is an exception thrown from a
test_stop
listener, the run-time flag is not respected and thesession keeps running indefinitely.
Expected behavior
The session should stop even if the listeners throw exceptions.
Actual behavior
The traceback is printed, and the session keeps running.
Steps to reproduce
Take, for example, the following
locustfile.py
:If locust is run with the following command line:
locust -t1 -r1 -u10 --headless --host http://www.google.com
you see the exception being raised and the session continues:
Environment
The text was updated successfully, but these errors were encountered: