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

cacheprovider: fix some files in packages getting lost from --lf #7915

Merged
merged 1 commit into from Oct 21, 2020

Conversation

@bluetech
Copy link
Member

@bluetech bluetech commented Oct 19, 2020

Fixes #7758. There are several reports in there, I only checked the one from #7894, but let's hope it also fixes the pandas report.

--lf has an optimization where it skips collecting Modules (python files) which don't contain failing tests. The optimization works by getting the paths of all cached failed tests and skipping the collection of Modules whose path is not included in that list.

In pytest, Package nodes are Module nodes with the fspath being the file <package dir>/__init__.py. Since it's a Module the logic above triggered for it, and because it's an __init__.py file which is unlikely to have any failing tests in it, it is skipped, which causes its entire directory to be skipped, including any Modules inside it with failing tests.

Fix by special-casing Packages to never filter. This means entire Packages are never filtered, the Modules themselves are always checked. It is reasonable to consider an optimization which does filter entire packages bases on parent paths etc. but this wouldn't actually save any real work so is really not worth it.

--lf has an optimization where it skips collecting Modules (python
files) which don't contain failing tests. The optimization works by
getting the paths of all cached failed tests and skipping the collection
of Modules whose path is not included in that list.

In pytest, Package nodes are Module nodes with the fspath being the file
`<package dir>/__init__.py`. Since it's a Module the logic above
triggered for it, and because it's an `__init__.py` file which is
unlikely to have any failing tests in it, it is skipped, which causes
its entire directory to be skipped, including any Modules inside it with
failing tests.

Fix by special-casing Packages to never filter. This means entire
Packages are never filtered, the Modules themselves are always checked.
It is reasonable to consider an optimization which does filter entire
packages bases on parent paths etc. but this wouldn't actually save any
real work so is really not worth it.
Copy link
Member

@nicoddemus nicoddemus left a comment

Thanks @bluetech!

@bluetech bluetech merged commit a66b6b8 into pytest-dev:master Oct 21, 2020
18 of 19 checks passed
18 of 19 checks passed
build (windows-py36)
Details
build (windows-py37)
Details
build (windows-py37-pluggy)
Details
build (windows-py38)
Details
build (ubuntu-py36)
Details
build (ubuntu-py37) build (ubuntu-py37)
Details
build (ubuntu-py37-pluggy)
Details
build (ubuntu-py37-freeze)
Details
build (ubuntu-py38)
Details
build (ubuntu-py39) build (ubuntu-py39)
Details
build (ubuntu-pypy3)
Details
build (macos-py37)
Details
build (macos-py38)
Details
build (docs)
Details
build (doctesting)
Details
build (plugins)
Details
linting linting
Details
codecov/patch 100.00% of diff hit (target 95.14%)
Details
docs/readthedocs.org:pytest Read the Docs build succeeded!
Details
bluetech added a commit to bluetech/pytest that referenced this pull request Oct 21, 2020
cacheprovider: fix some files in packages getting lost from --lf
(cherry picked from commit a66b6b8)
bluetech added a commit to bluetech/pytest that referenced this pull request Oct 21, 2020
cacheprovider: fix some files in packages getting lost from --lf
(cherry picked from commit a66b6b8)

with some needed adjustments to 6.1.x.
@bluetech bluetech deleted the bluetech:fix-lf-package branch Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants