pytest-mypy-plugins
pytest-mypy-plugins copied to clipboard
Support for mypy .test files.
This is a feature request.
It might be nice to get support for handling mypy-style .test
files:
[case foo]
reveal_type(1 + 1) # N: Revealed type is "builtins.int"
[out]]
-- Comment
[case bar]
reveal_type(1 + 1)
[out]
main:2: note: Revealed type is "builtins.int"
Why not just use mypy
's test then? It is a completely different format 🤔
Why not just use
mypy
's test then?
Good question. I guess that depends on the use case. I used mypy tests in the past, and accumulated a lot of test files. However:
- It is internal and undocumented feature.
- It assumes rather specific project layout.
So it is hard sell for more strict projects.
Additionally, supporting these here, would allow smoother migration without keeping track of what should go into mypy.test.testcheck.TypeCheckSuite.files
. Huge win for me :)
It is a completely different format 🤔
Up to certain point. Once you parse input file into cases containing:
-
options: Optional[str]
-
main: str
-
out:str
handling both main
and out
shouldn't require additional logic (inline comment format is the same, and out is just mypy output).
I am aware that it might be out-of-scope here, just the idea :)
Another idea: mypy
's .test
files converter into our yml
format? 🤔
It might be easier!