Closed
Description
Currently, pytest discovery fail for the entire project if a single import is missing on a single file:
E ModuleNotFoundError: No module named 'xyz'
ERROR my_test.py
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
Exception: pytest discovery failed (exit code 2)
Only 1/600 file failed, but VS Code does not show the 599 tests which were correctly discovered.
Many other project have "optional" deps which add extra features. Those extra deps shouldn't be required when the full project do not need to be tested.
My project has many independent modules, each requiring a specific set of dependencies (pip install .[module0]
). Contributors should not be forced to install the full dependencies of all modules / features when they only want to test a subpart.
Related issues:
Those issues are not duplicate but seems related:
- Perform test discovery per-file when a file is updated/added. #4586: Perform test discovery per-file when a file is updated/added: This issue focus about performances, as re-discovering the full set of files each time is slow.
- Test discovery fails if package is not installed #10469: Test discovery fails if package is not installed: This is about a specifc case where a specific import was not correctly detected.