From 67bf34ab11e6253a62505480b9972c3e88a9946e Mon Sep 17 00:00:00 2001 From: root Date: Fri, 25 Oct 2024 11:48:21 +0300 Subject: [PATCH] Recurse into build / dist directories See #12625 for context --- src/_pytest/main.py | 2 -- testing/test_collection.py | 13 +++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/_pytest/main.py b/src/_pytest/main.py index e5534e98d69..534b60114e7 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -63,9 +63,7 @@ def pytest_addoption(parser: Parser) -> None: "*.egg", ".*", "_darcs", - "build", "CVS", - "dist", "node_modules", "venv", "{arch}", diff --git a/testing/test_collection.py b/testing/test_collection.py index aba8f8ea48d..60673dce297 100644 --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -135,10 +135,19 @@ def test_foo(): class TestCollectFS: + def test_build_conditional_ignore(self, pytester: Pytester) -> None: + tmp_path = pytester.path + ensure_file(tmp_path / "build" / "test_found.py") + ensure_file(tmp_path / "dist" / "test_found.py") + for x in tmp_path.rglob("test_*.py"): + x.write_text("def test_hello(): pass", encoding="utf-8") + + result = pytester.runpytest("--collect-only") + s = result.stdout.str() + assert "test_found" in s + def test_ignored_certain_directories(self, pytester: Pytester) -> None: tmp_path = pytester.path - ensure_file(tmp_path / "build" / "test_notfound.py") - ensure_file(tmp_path / "dist" / "test_notfound.py") ensure_file(tmp_path / "_darcs" / "test_notfound.py") ensure_file(tmp_path / "CVS" / "test_notfound.py") ensure_file(tmp_path / "{arch}" / "test_notfound.py")