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
PyTest discovery can fail but not give any clue as to what the problem is #12043
If there's a bug in my code, I can get this message:
What I really need is this error which is in the Python Test log
ImportError: cannot import name 'today' from 'datetime' (C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2032.0_x64__qbz5n2kfra8p0\lib\datetime.py)
It would be nice if this was surfaced somewhere. Either by having a link to jump to this output panel on the error (instead of checking the configuration) or even better showing the error in the problems panel.
Here is how the "Test Explorer UI" extension handles this situation. The Python extension should do something similar:
The extensions I have:
When there is a discovery error, a line is shown in the Test Sidebar window:
If you double-click this line in the test explorer window, it opens the Output window to the "Test Explorer" pane, and shows the output from the attempt to discover tests:
With Python, it just shows a blank screen in the Sidebar:
And the results do appear in the "Python Test Log" pane in the Output window, which you can get to by clicking the "show test output" icon, the second from the right:
But it could certainly be made a more obvious.
I had lots of problems figuring out how to find test discovery error information, and a lot of frustration, when I started using VS Code seriously for Python.
Making an improvement here would reduce a lot of issues logged here by newer users who don't understand how to find the test discovery failure information, like the user who originally posted this.
Thank you for the suggestion! We have marked this issue as "needs decision" to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 👍 votes the opening comment gets to help us make our decision.
Activity
LightCC commentedon May 30, 2020
Here is how the "Test Explorer UI" extension handles this situation. The Python extension should do something similar:
The extensions I have:

When there is a discovery error, a line is shown in the Test Sidebar window:

If you double-click this line in the test explorer window, it opens the Output window to the "Test Explorer" pane, and shows the output from the attempt to discover tests:
With Python, it just shows a blank screen in the Sidebar:
And the results do appear in the "Python Test Log" pane in the Output window, which you can get to by clicking the "show test output" icon, the second from the right:
But it could certainly be made a more obvious.
I had lots of problems figuring out how to find test discovery error information, and a lot of frustration, when I started using VS Code seriously for Python.
Making an improvement here would reduce a lot of issues logged here by newer users who don't understand how to find the test discovery failure information, like the user who originally posted this.
brettcannon commentedon Jun 1, 2020
Thank you for the suggestion! We have marked this issue as "needs decision" to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 👍 votes the opening comment gets to help us make our decision.