Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pytest] Add an inline error indicating the location in code where test discovery failed #19401

Closed
MaddyGuthridge opened this issue Jul 4, 2022 · 4 comments
Assignees
Labels
area-testing community ask Feature request that the community expressed interest in feature-request Request for new features or functionality info-needed Issue requires more information from poster needs proposal Need to make some design decisions

Comments

@MaddyGuthridge
Copy link

If there is a runtime error that occurs when discovering tests, it is quite a hassle to determine the point at which it failed.

The current method

Open the Output > Python log and scroll back until you find the spot where Pytest failed to discover your tests. Or alternatively, launch a terminal and run pytest yourself and search through its output to find the error.

My proposition

When Pytest discovery fails, the output is parsed to determine the location where it failed, so that an inline error can be created on that line of code. This makes it easier to spot issues that are causing Pytests to fail to run. Preferably, a quick link to that position would be provided for when you click on "Pytest discovery failed" in the testing panel, and the full details of the error would be provided within the inline error.

Adding this improvement would greatly simplify the process of finding errors when Pytest fails to run, especially for when those errors aren't picked up by the main language server (eg logical errors, or some issues with type hinting).

@MaddyGuthridge MaddyGuthridge added the feature-request Request for new features or functionality label Jul 4, 2022
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jul 4, 2022
@karthiknadig karthiknadig added area-testing needs community feedback Awaiting community feedback labels Jul 5, 2022
@karthiknadig
Copy link
Member

Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.

@karthiknadig karthiknadig removed the triage-needed Needs assignment to the proper sub-team label Jul 5, 2022
@brettcannon
Copy link
Member

Thank you to everyone who upvoted this issue! Since the community showed interest in this feature request we will leave this issue open as something to consider implementing at some point in the future.

We do encourage people to continue 👍 the first/opening comment as it helps us prioritize our work based on what the community seems to want the most.

@brettcannon brettcannon added needs proposal Need to make some design decisions community ask Feature request that the community expressed interest in and removed needs community feedback Awaiting community feedback labels Sep 22, 2022
@eleanorjboyd eleanorjboyd self-assigned this Dec 4, 2023
@eleanorjboyd
Copy link
Member

Looking through this issue I think getting inline errors for pytest would be quite challenging due to the need to parse output which we also have seen can be hard to get right. That being said, I think that ask is out of scope for what is achievable in the project right now.

On the other hand, I think a link that would open the correct log line with the specific error is doable.

I am curious if anyone has gotten errors with the rewrite and what they think. Currently the error listing is right at the bottom of the logs and Im wondering if this is sufficient given the new button that opens the logs which will appear on the test explorer view.

What are people's thoughts? Is it a worthwhile feature add to link the specific log line?

@eleanorjboyd eleanorjboyd added the info-needed Issue requires more information from poster label Dec 5, 2023
Copy link

github-actions bot commented Jan 5, 2024

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.

Happy Coding!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 5, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing community ask Feature request that the community expressed interest in feature-request Request for new features or functionality info-needed Issue requires more information from poster needs proposal Need to make some design decisions
Projects
None yet
Development

No branches or pull requests

4 participants