Skip to content

Migrate away from pytest-mypy-plugins .yml files for non-error cases #9

Open
@h4l

Description

@h4l

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions