Closed hangonlyra closed 4 months ago
Having user classes with no tasks is an error (but shouldnt give this weird crash).
If you dont want instances of a class to be created, just set the abstract = True attribute on the class.
Your fix might still be appropriate but I’m not sure..
Oh that's fair. Thanks for the analysis and suggestion. I'll prep a PR. I think it will still be nice to have it not crash like that. Plus the change is minute.
Prerequisites
Description
After upgrading from 2.19.0 to 2.25.0 (this bug exists in 2.21.0+), I get
This was trace back to an
User
class that has notasks
defined. The reason that class exists in my project is because all my other user classes inherit from it.The fix is actually very simple too:
In
locust/main.py
, on line 129 changeto
since everywhere else
available_user_tasks
is expected to be iterable.For now one can just work around it by adding:
to the class affected by this.
Command line
locust
Locustfile contents
Python version
3.8, 3.9, 3.10
Locust version
2.21.0 to 2.25.0
Operating system
Linux or Mac OS