-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Support adding class variables to class through assignment #8723
Comments
Yeah, adding to a class through a class variable write could be handy, though I doubt it is really on the roadmap for us to implement. There ought to be an issue open for it but I couldn't find one, so I'll leave this open. |
Ah, I'd assumed that the support for |
@PeterJCLaw can you elaborate on your workaround to this problem? I tried typing my variables in |
I think I worked around this by adding the variables to the class and marking them as |
That worked for me. Thanks! |
I couldn't find any prior art for asyncSetUpClass, so this is a bit hacky, but it's the obvious way to implement it, and it works fine for rsyscall. Annoyingly mypy requires us to explicitly declare the class variables, see python/mypy#8723
Mypy supports adding items to
self
during testsetUp
, which is great. However in many cases it's useful to be able to add items to the class duringsetUpClass
(or Django'ssetUpTestData
).Adding a
ClassVar
allows for a workaround to this, however it would be nice if that wasn't needed.The text was updated successfully, but these errors were encountered: