Mypy supports adding items to self during test setUp, which is great. However in many cases it's useful to be able to add items to the class during setUpClass (or Django's setUpTestData).
import unittest
class Tests(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.foo = 42 # "Type[Tests]" has no attribute "foo"
def test_foo(self) -> None:
print(self.foo) # "Tests" has no attribute "foo"
Adding a ClassVar allows for a workaround to this, however it would be nice if that wasn't needed.