-
Notifications
You must be signed in to change notification settings - Fork 773
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
importlib.metadata.distributions() doesn't surface all installed packages/endpoints, breaking pytest plugins #6376
Comments
I think the problem you're running into here is that |
Some documentation on this at https://docs.astral.sh/uv/concepts/tools/#relationship-to-uv-run We may be able to improve the documentation though, if you have any questions. |
Yes, that's fixed it! Thanks 👍 |
Addressing that with #6454 — let me know if that's not helpful. |
That looks spot on 👍 |
I tried to migrate a project to uv, but pytest could no longer find its plugins pytest-cov and pytest-testmon.
On investigation it seems that pytest uses Pluggy to load the plugins, and Pluggy uses importlib.metadata.distributions() to identify and load installed packages that have entrypoints matching its naming convention (see Pluggy source)
I made an empty project with "uv init", added dependencies [ "pytest", "pytest-cov", "pytest-testmon" ], ran "uv sync" successfully (I can see the installed files in .venv/lib/site-packages) and ran the following code
Under my regular project this code prints (among other things):
Under my uv test project those modules/endpoints are not in the list, even though they have been successfully installed.
and this is on Win11.
The text was updated successfully, but these errors were encountered: