Skip to content
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

Type safe async setUp and tearDown for twisted.trial.unittest.TestCase #12037

Open
graingert opened this issue Nov 13, 2023 · 0 comments · May be fixed by #12038
Open

Type safe async setUp and tearDown for twisted.trial.unittest.TestCase #12037

graingert opened this issue Nov 13, 2023 · 0 comments · May be fixed by #12038

Comments

@graingert
Copy link
Member

graingert commented Nov 13, 2023

Is your feature request related to a problem? Please describe.
when defining an async/deferred returning tearDown or setUp mypy fails with a override error or misc error on mixins.

Describe the solution you'd like
also call asyncSetUp and asyncTearDown methods defined on TestCase subclasses in deferSetUp and deferTearDown

these methods will be defined on _asynctest.TestCase as:

async def asyncSetUp(self) -> None: return None
async def asyncTearDown(self) -> None: return None

Describe alternatives you've considered
I attempted to add a # type: ignore[override] to the _asynctest.TestCase but it doesn't help further subclasses that also need to #type: ignore[override]

Additional context
https://mypy-play.net/?mypy=latest&python=3.11&gist=721064188d7ccae3d8360fc748e1c781&flags=strict
python/mypy#12372

@graingert graingert linked a pull request Nov 13, 2023 that will close this issue
@graingert graingert changed the title Type safe async setUp and tearDown for twisted.trial.TestCase Type safe async setUp and tearDown for twisted.trial.unittest.TestCase Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant