You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading from 2.19.0 to 2.25.0 (this bug exists in 2.21.0+), I get
Traceback (most recent call last):
File "/Users/hang/Source/qa_automation/performance/playwright/env/bin/locust", line 8, in <module>
sys.exit(main())
File "/Users/hang/Source/qa_automation/performance/playwright/env/lib/python3.8/site-packages/locust/main.py", line 493, in main
web_ui = environment.create_web_ui(
File "/Users/hang/Source/qa_automation/performance/playwright/env/lib/python3.8/site-packages/locust/env.py", line 186, in create_web_ui
self.web_ui = WebUI(
File "/Users/hang/Source/qa_automation/performance/playwright/env/lib/python3.8/site-packages/locust/web.py", line 142, in __init__
self.update_template_args()
File "/Users/hang/Source/qa_automation/performance/playwright/env/lib/python3.8/site-packages/locust/web.py", line 630, in update_template_args
{
File "/Users/hang/Source/qa_automation/performance/playwright/env/lib/python3.8/site-packages/locust/web.py", line 631, in <dictcomp>
user_class_name: [task.__name__ for task in user_class]
TypeError: 'NoneType' object is not iterable
This was trace back to an User class that has no tasks 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 change
available_user_tasks[key] =value.tasksorNone
to
available_user_tasks[key] =value.tasksor []
since everywhere else available_user_tasks is expected to be iterable.
For now one can just work around it by adding:
@taskdefbogus(self):
# Work around for this bug: https://github.com/locustio/locust/issues/2694pass
to the class affected by this.
Command line
locust
Locustfile contents
fromlocustimportUserclassCustomUser(User):
pass
Python version
3.8, 3.9, 3.10
Locust version
2.21.0 to 2.25.0
Operating system
Linux or Mac OS
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: