Skip to content

Run mypy on our tests again #7909

@ohemorange

Description

@ohemorange

Similarly to #7908, when we moved our tests out of our packages, we accidentally stopped running mypy on them. Getting mypy to run on the tests won't be an issue, but if we run it as is, we start to hit errors. The first level of these, which causes mypy to print an error and stop running, is the duplicate named files (for example, acme/tests/client_test.py and certbot/tests/client_test.py). A way to fix that would be to run a small script that runs mypy individual on each directory and/or module. But a complication here is that many of the files depend on acme/acme/magic_typing.py, and will print errors when not run alongside acme/acme. Hardcoding that in would be a bit of a hack, so a better solution is probably to deprecate magic_typing by no longer doing any Python 2.7-style mypy support in our codebase (also see #7806).

If we choose to go ahead with option 2 from #7908, that may solve at least some of the issues (probably the ones around naming, since those weren't a problem before we reorganized the tests and removed the __init__.pys). But there are some other issues to deal with.

An initial attempt at dealing with all of this was made on the run-all-mypy branch, but that is probably not actually the best way to move forward here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions