Test dicovery doesn't provide feedback on failure
See original GitHub issueI find quite often my tests “disappear” from the test window, or discovery appears to do nothing. This is almost always because I’ve introduced a syntax error in the package I’m testing which results in an import failure. The reason is clear in the Python Test Log, i.e. below I forgot to install a dependency culminating in discovery failing with exit code 2. If this should happen at the very least the test sidebar should provide some indication that test discovery exited abnormally - perhaps with a highlight on the “Show Test Output” icon since clicking on that is the first step in resolving the issue.
Test Discovery failed:
Error: ============================= test session starts ==============================
<snip>
import ahocorasick # pip install pyahocorasick
E ModuleNotFoundError: No module named 'ahocorasick'
=========================== short test summary info ============================
ERROR tests/test_label_model.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
===================== 5 tests collected, 1 error in 2.00s ======================
Traceback (most recent call last):
File "/home/david/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/run_adapter.py", line 22, in <module>
main(tool, cmd, subargs, toolargs)
File "/home/david/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/__main__.py", line 100, in main
parents, result = run(toolargs, **subargs)
File "/home/david/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 44, in discover
raise Exception("pytest discovery failed (exit code {})".format(ec))
Exception: pytest discovery failed (exit code 2)
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Python Test Discovery Failed with no error message #11513
According to the Python testing page when I click on the icon that says "Test discovery failed" it should provide more information.
Read more >TestExplorer test discovery for google tests doesn't work since ...
Since Visual Studio 16.4.6, none of the solutions described above work anymore - the discovery can not find any test. I've tried the...
Read more >Visual Studio Test Explorer FAQ - Microsoft Learn
Refer to these frequently asked questions about Visual Studio Test Explorer, which include some common troubleshooting.
Read more >Why is the Visual Studio 2015/2017/2019 Test Runner not ...
Eliminate discovery exceptions from your inquiries; go to the output Window (Ctrl-Alt-O), then switch the show output from dropdown (Shift-Alt-S) to Tests ......
Read more >Failure is Feedback: Unit Testing - Coveros
Do not allow broken tests to simply be turned off, ignored or deleted. A failing test is feedback that needs attention.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Depends on the test framework, and type of error. On unittest, the test in that particular file with syntax error will be skipped. In pytest, currently syntax errors means it won’t be able to see any of the other tests. We have plans on making that part better when we update our integration with pytest.
Yeah this is a huge bummer w/ pytest.
Great! Looking forward to it.