Merge pull request #11055 from bluetech/lf-skipped-package

cacheprovider: fix file-skipping feature for files in packages
This commit is contained in:
Ran Benita 2023-05-30 20:04:06 +03:00 committed by GitHub
commit 3a6bdcd76b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View File

@ -0,0 +1 @@
Fixed ``--last-failed``'s "(skipped N files)" functionality for files inside of packages (directories with `__init__.py` files).

View File

@ -219,7 +219,7 @@ class LFPluginCollWrapper:
@hookimpl(hookwrapper=True)
def pytest_make_collect_report(self, collector: nodes.Collector):
if isinstance(collector, Session):
if isinstance(collector, (Session, Package)):
out = yield
res: CollectReport = out.get_result()

View File

@ -420,7 +420,13 @@ class TestLastFailed:
result = pytester.runpytest()
result.stdout.fnmatch_lines(["*1 failed in*"])
def test_terminal_report_lastfailed(self, pytester: Pytester) -> None:
@pytest.mark.parametrize("parent", ("session", "package"))
def test_terminal_report_lastfailed(self, pytester: Pytester, parent: str) -> None:
if parent == "package":
pytester.makepyfile(
__init__="",
)
test_a = pytester.makepyfile(
test_a="""
def test_a1(): pass