Skip to content

Perform test discovery per-file when a file is updated/added. #4586

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

Open
ericsnowcurrently opened this issue Feb 27, 2019 · 5 comments
Open
Assignees
Labels
area-testing feature-request Request for new features or functionality needs proposal Need to make some design decisions

Comments

@ericsnowcurrently
Copy link
Member

Currently we only perform test discovery on the whole project. This is unnecessary when discovery happens in response to a file being created, updated, or deleted. We should be able to perform discovery on a per-file basis in those cases. Doing so will be more efficient and allow us to be more granular in how we present test status.

This is effectively blocked by a uniform test discovery API for the different test frameworks (e.g. like we're doing in #3911 for pytest).

@Conchylicultor
Copy link

@luabud thank you for looking into this !!

When implementing per-file discovery, it would be awesome if all discovered tests gets displayed, even if other files fails. Currently a single wrong file cause the entire test discovery to fail. (See #13301 for context)

@shanewazabbas
Copy link

hey @eleanorjboyd , since I dont have permission to respond to: #22582. I'll reply here. We decided to go with a modular monolith approach in our repo with each module having a conftest to avoid unnecessary analysis by pytest. Basically solving it by working around pytest. And we have noticed much improved time in test discovery. So no need to focus on #22582 if you dont have bandwidth.

@eleanorjboyd
Copy link
Member

Thanks for the heads up! Glad you got a solution which worked for you

@senhalil
Copy link

senhalil commented Mar 5, 2025

Do you have any updates on this issue?

We have a monorepo and test discovery takes ~3 minutes at the moment. This makes vscode quite clunky -- i.e., after modifying/adding a test, one needs to wait for it to be "discovered" by vscode-python.

If the discovery was based on file modifications, one new test file or new/modified tests in an existing file would be picked up instantaneously -- i.e., it would not parse all the files with unchanged dates/hashes.

@eleanorjboyd
Copy link
Member

Still something we would love to do! We prioritize feature requests based on upvotes- so the more upvotes the higher the feature will sit on our priority list. Amplifying this issue to those at your company who are impacted and getting them to upvote would help. The other option is putting in a PR with the fix and then I can take a look and would not have to take development time for it. In the meantime another user did add a feature request that could help- which is the setting for which files to rediscover tests on. Maybe this could help in the time-being. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-testing feature-request Request for new features or functionality needs proposal Need to make some design decisions
Projects
None yet
Development

No branches or pull requests

6 participants