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
{{ message }}
Repository navigation
Test discovery should be fault tolerant and display all successfully imported files #13301
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.
--continue-on-collection-errors makes test discovery bit better when there are issues with loading test files. However, adding support that will require a bit of work in the current test adapter. We have plans to update the adapter to be more robust. We also have to see if similar support can be provided on other supported test frameworks.
Hello! This should be fixed in the rewrite which is currently underway! The meta-issue is here and that will track progress but I will keep this issue open as well until resolved. Thanks!
Activity
karthiknadig commentedon Aug 6, 2020
Were you able to get
pytestorunittestto show tests via command line, even with import errors?Conchylicultor commentedon Aug 6, 2020
Yes,
pytest --collect-onlycorrectly detect the valid tests:Additionally,
pytest --continue-on-collection-errorscorrectly execute the valid tests.Conchylicultor commentedon Aug 10, 2020
Shouldn't the
info neededlabel be removed ?karthiknadig commentedon Aug 10, 2020
--continue-on-collection-errorsmakes test discovery bit better when there are issues with loading test files. However, adding support that will require a bit of work in the current test adapter. We have plans to update the adapter to be more robust. We also have to see if similar support can be provided on other supported test frameworks.3 remaining items
fnobis commentedon Jan 3, 2023
I am facing the same error with the plugin. For manual test discovery in a terminal I can fix the error by executing:
pip install -e LOCAL_PACKAGE_PATHsource ~/ROS2_WORKSPACECan I prepend these command somehow to the plugin, so that I could use the test discovery?
eleanorjboyd commentedon Jan 6, 2023
Hello! This should be fixed in the rewrite which is currently underway! The meta-issue is here and that will track progress but I will keep this issue open as well until resolved. Thanks!
display errors and tests on discovery (#21629)
eleanorjboyd commentedon Jul 21, 2023
Hello! A fix for this is out on insiders! If someone could tests and let me know it worked that would be great!
Verification steps:
Merged PR posit-dev/positron-python#151: Merge upstream as of 2023 Ju…
Merged PR posit-dev/positron-python#151: Merge upstream as of 2023 Ju…