You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Moving Lib/test/test_import/__init__.py to Lib/test/test_import/test_import.py .
Creating a new Lib/test/test_import/__init__.py that defines load_tests hook that calls load_package_tests.
It is visible by now that this is a can of worms. Lib.test.test_import uses relative imports itself, so moving Lib.test.test_import to Lib.test.test_import.test_import breaks them. This means we'd need to massage Lib.test.test_import.test_import to work again, which means we'd need to modify old tests -- which I think on its own disqualifies this approach.
We can't have Lib.test.test_import and Lib.test.test_import.test_lazy_imports at the same time set up in a maintainable way, because it would involve having manual registration of test suites in test_import (or maybe in test_lazy_imports?). Perhaps we can do this cheaply, but I assume this makes these tests less self-contained and complicates the setup.
I propose we move Lib/test/test_import/test_lazy_imports.py (+data) into Lib/test/test_lazy_import/__init__.py (+data). Unless there is any other cost-effective solution to this that I've missed?
Activity
[-]We're not `test_lazy_imports` in CI[/-][+]We're not running `test_lazy_imports` in CI[/+][-]We're not running `test_lazy_imports` in CI[/-][+]We don't run `test_lazy_imports` in CI[/+][-]We don't run `test_lazy_imports` in CI[/-][+]We don't run `test_lazy_imports`[/+]pablogsal commentedon Feb 28, 2026
Oh wow, good catch! Excellent job!
gh-145334: Make lazy import tests discoverable (#145336)
pythongh-145334: Make lazy import tests discoverable (python#145336)
pythongh-145334: Make lazy import tests discoverable (python#145336)