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")