Skip to content

Test third-party stubs in isolation #6229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 7, 2021

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented Nov 3, 2021

This is a first step towards #5952. For each third-party distribution, a separate mypy call is started. This has a few advantages, but also a few drawbacks:

  • Missing dependencies in METADATA.toml are now spotted, since only the dependencies listed there are being added to the list of files to test.
  • It's possible to add a custom configuration for a distribution to METADATA.toml. Previously, all configurations were merged before mypy was run, therefore all configurations applied to all files. Now, only the configurations of a distribution and its dependencies are merged when testing a distribution.
  • Adding a non-stub dependency will crash the tests. (But this wouldn't work anyway, at the moment. This is actually a first step towards allowing this.)
  • Stubs are now tested multiple times if they are part of the dependency chain of another distribution.

In the future, each distribution should get its own venv, so that the dependencies can be installed from pypi. See #5952 for the rationale.

The code in mypy_test.py is quite janky and hard to read at this point. I wanted to keep refactorings out of this PR, but might send a separate cleanup PR later.

@srittau srittau marked this pull request as ready for review November 3, 2021 10:45
@srittau srittau mentioned this pull request Nov 3, 2021
@JelleZijlstra JelleZijlstra merged commit 50c1f2a into python:master Nov 7, 2021
@srittau srittau deleted the 3rd-party-tests branch November 7, 2021 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants