Open
Description
We've been using pytest-mypy-plugins
.yml
files to test type annotations. They are quite cumbersome to work with, and prone to failing after dependency updates due to error messages/mypy output changes.
For non-error tests, I think it'd be better to use typing.assert_type()
in regular pytest tests. This would allow also checking that runtime behaviour matches type annotations where necessary.
It seems OK to keep using the .yml files to demonstrate type errors, as there isn't a good way to assert about type errors, other than # type: ignore[xxx]
,.
PRs to incrementally move tests out of .yml files into .py tests welcome!