-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Add discover_imports
in conf, don't collect imported classes named Test* closes #12749`
#12810
Open
FreerGit
wants to merge
9
commits into
pytest-dev:main
Choose a base branch
from
FreerGit:dont-auto-discover-feat
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+362
−3
Open
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
222457d
Add `discover_imports` in conf
FreerGit fa3b631
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 68ac4a1
`collect_imported_tests` option
FreerGit a6ee0bc
merge: rename from discover to collect
FreerGit eb8592c
update default and add docs
FreerGit 935c06d
WIP: don't collect instead of filtering out
FreerGit 191456e
WIP: modified items, reports and items collected
FreerGit f1821ea
WIP - report collection needs triage
FreerGit 022d316
Ensure correct collection of reports
FreerGit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point, I need some guidance.
The problem now is that while the CollectReport's for classes and functions are correct, the directory gets a report (even though no classes/functions were collected from it). What should be the expected behaviour in this case? Since the directory will be collected before any of the classes/functions I would need to filter it out later on somehow. Not sure what the correct approach is here.
I do feel like collecting the report for the directory (even though it's not "used") makes sense but I would need a maintainer to check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct -- currently on
main
if we implementpytest_collectreport
and run pytest on a bunch of directories without any tests, we get collection reports for all directories, even though no test items were collected.My previous concern was that we were generating collection reports for items that were in fact being discarded later, and that would definitely be a problem -- but collection reports for directories it is expected that some of them might turn out to not collect anything.