Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.2k
Description
Bug report
Bug description:
This isLib.test.test_import:
Lib/test/test_import├── __init__.py├── __main__.py├── data└── test_lazy_imports.pyOur test finder doesn't seetest_lazy_imports:#144852 (comment).
python -m test does not runtest_lazy_imports at all.
We could try to keep regular import test package with lazy import test package by:
- Updating
Lib.test.libregrtest.findtests.SPLITTESTDIRSto includetest_import. - Moving
Lib/test/test_import/__init__.pytoLib/test/test_import/test_import.py. - Creating a new
Lib/test/test_import/__init__.pythat definesload_testshook that callsload_package_tests.
It is visible by now that this is a can of worms.Lib.test.test_import uses relative imports itself, so movingLib.test.test_import toLib.test.test_import.test_import breaks them. This means we'd need to massageLib.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 haveLib.test.test_import andLib.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 intest_import (or maybe intest_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 moveLib/test/test_import/test_lazy_imports.py (+data) intoLib/test/test_lazy_import/__init__.py (+data). Unless there is any other cost-effective solution to this that I've missed?
CC@pablogsal@DinoV@brittanyrey@Yhg1s@vstinner@sobolevn
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response