-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Testing third-party stubs in isolated environments #5952
Comments
A possible downside: If the tests of a third-party stub break for some reason, e.g. because a new version of the corresponding non-stub package is released, the problem will remain unnoticed until someone makes a PR for that specific stub package. I remember most pull requests showing red CI because of some Pillow thing, but can't find it from the PR history now. |
It would be useful to run full tests at a regular interval, say once per day or week. |
Note the stubtest third party code already does this venv creation. We could steal that code / maybe use some fancy Github Actions CI caching to cache venvs across workflows. Switching to testing only changed third party stubs is probably a better idea than just doing everything and sharding, which is the approach test_stubtest currently takes. Like you say, I'd want to think through how we manage different stdlib and types-* versions; to that goal, here are some previous issues we've had on those lines: #4815 #5786 #5751 |
This seems to be done now. |
No, we still need to use separate venvs for each distribution, so that the dependencies don't interfere with each other. |
I would be interested in working on this mainly to make it possible to have non-types dependencies. Would reasonable steps in order be,
Any major tasks I'm missing? |
That sounds reasonable. Some thoughts:
|
@hmc-cs-mdrissi For now you could try to skip step 1 and we can see how that affects CI runtimes. |
As of #9408, third-party stubs with non-types dependencies are now tested with mypy in isolated venvs. The venvs are setup concurrently using a threadpool, meaning we still test all typeshed stubs packages in every run, but the script remains performant. (Stubs packages with no non-types dependencies are not tested in a separate venv, but they are tested using the Closing as completed! 🥳 |
At the moment, whenever there is change to typeshed, we test all stdlib and third-party packages in the same testing environment, using the
--custom-typeshed-dir
so that all packages can see each other. There are several practical problems with that:requires
fields for correctness; all packages are always available.paramiko
: Change dependencies ontypes-cryptography
, allow using upstream type hints #5847, and the discussion in Allow non-types dependencies #5769 (all related tocryptography
). (Except if we'd just install all non-types dependencies for all package into our venv.)My suggestion: Only run the tests for the third-party stubs that have actually changed, and run each test in a separate environment. This environment only has the requirements from
METADATA.toml
installed. This fixes the problems above and also means:The text was updated successfully, but these errors were encountered: