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
I found a bug which raises the stack-trace below when defining a type variable before a locust class.
It looks to only affect when setting a type as shown in the MWE, though I've not tested many variations.
Removing RequestDict = dict[str, object] fixed the issue.
✦ ❯ locust -f scripts/locustfile.py
Traceback (most recent call last):
File "/Users/daarashaw/dev/repo/.venv/bin/locust", line 8, in <module>
sys.exit(main())
File "/Users/daarashaw/dev/repo/.venv/lib/python3.10/site-packages/locust/main.py", line 112, in main
docstring, _user_classes, shape_classes = load_locustfile(_locustfile)
File "/Users/daarashaw/dev/repo/.venv/lib/python3.10/site-packages/locust/util/load_locustfile.py", line 83, in load_locustfile
shape_classes = [value() for value in vars(imported).values() if is_shape_class(value)]
File "/Users/daarashaw/dev/repo/.venv/lib/python3.10/site-packages/locust/util/load_locustfile.py", line 83, in <listcomp>
shape_classes = [value() for value in vars(imported).values() if is_shape_class(value)]
File "/Users/daarashaw/dev/repo/.venv/lib/python3.10/site-packages/locust/util/load_locustfile.py", line 24, in is_shape_class
return bool(inspect.isclass(item) and issubclass(item, LoadTestShape) and not getattr(item, "abstract", True))
File "/Users/daarashaw/.pyenv/versions/3.10.13/lib/python3.10/abc.py", line 123, in __subclasscheck__
return _abc_subclasscheck(cls, subclass)
TypeError: issubclass() arg 1 must be a class
Prerequisites
Description
I found a bug which raises the stack-trace below when defining a type variable before a locust class.
It looks to only affect when setting a type as shown in the MWE, though I've not tested many variations.
Removing
RequestDict = dict[str, object]
fixed the issue.Command line
locust -f scripts/locustfile.py
Locustfile contents
Python version
3.10.13
Locust version
2.32.4
Operating system
MacOS 14.6.1 (23G93)
The text was updated successfully, but these errors were encountered: