-
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
setup() should always run after __init__() #829
Comments
Why not just rename your method:
|
Well, Either way, I wasn't fully aware how the threads are initiated and how |
Not pointless, just used for different setup tasks. I think what you are looking for are the have you read the new docs?... they explain it well: setup/teardown:
vs. on_start/on_stop:
|
Ok, I see that I was wrong, I guess my confusion, as a person who just started using your package, comes from not knowing which code is run by multiple threads. You got 1.
|
Sorry for the late response @pszynk but I think you can do what you are trying to do simply by including the config in the locustfile itself, run as part of the file, because that will only be run once when it's included. Something like:
Presumably your setup is more complicated and it may require a slightly different init here but an approach like this should solve your "how do I load config once?" question. |
Description of issue / feature request
In the current implementation
Locust.setup()
method is run from withinLocust.__init__()
. But what if you want to inherit fromclass Locust
add your own__init__()
method and also usesetup()
. The most proper way would be:Expected behavior
I think that the best way would be to assure that
setup()
always runs after__init__()
. Of course you can put whole initialization insidesetup()
or just callsuper().__init__()
last, but that probably needs documentation.The text was updated successfully, but these errors were encountered: