Skip to content

PyTest discovery can fail but not give any clue as to what the problem is #12043

Closed

Description

@rchiodo

If there's a bug in my code, I can get this message:
image

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.

Activity

  1. LightCC commented on May 30, 2020

    @LightCC

    Here is how the "Test Explorer UI" extension handles this situation. The Python extension should do something similar:

    The extensions I have:
    image

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

    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:

    image

    With Python, it just shows a blank screen in the Sidebar:

    image

    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:

    image

    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.

  2. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Jun 1, 2020
  3. brettcannon commented on Jun 1, 2020

    @brettcannon
    Member

    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.

  4. locked as resolved and limited conversation to collaborators on Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions