Circumventing Name "_" already defined
mypy error #268
Description
Mypy really hates the pattern of naming every test like def _():
and errors on every Ward test with the message Name "_" already defined on line 79 [no-redef]
.
Type checking tests still often makes sense, so we should come up with a good way to circumvent the error and document that. Best would perhaps be if mypy had a configuration option to disable this specific error only, and only disable it in a test directory. That doesn't seem to be possible though.
Adding a # type: ignore[no-redef]
after each @test
decorator line works but is a bit laborious. Maybe make an auto-formatter (supporting pre-commit framework) that adds these ignore comments? Or even better, maybe there's a way to make a mypy plugin that tricks mypy into thinking these comments are in place, even if they really aren't (less clutter in the codebase).