Skip to content

Prevent unimported warnings @ pytest-xdist workers #695

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
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/pytest_cov/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ def start(self):
data_suffix=_data_suffix(f'w{self.nodeid}'),
config_file=self.cov_config,
)
self.cov._warn_unimported_source = False
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably include all those other hacks, after all:

Suggested change
self.cov._warn_unimported_source = False
self.cov._warn_no_data = False
self.cov._warn_unimported_source = False
self.cov._warn_preimported_source = False

Copy link
Member

@ionelmc ionelmc Jun 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, but without a test triggering these warnings you will never really know what effect this will have.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I only know that only one has a visible effect of suppressing a false negative in ansible-pylibssh. I've been trying to think of a reliable test but no luck so far.

self.cov.start()
self.set_env()
super().start()
Expand Down