Skip to content

Commit 67bf34a

Browse files
rootroot
root
authored and
root
committed
Recurse into build / dist directories
See #12625 for context
1 parent 26215b8 commit 67bf34a

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/_pytest/main.py

-2
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ def pytest_addoption(parser: Parser) -> None:
6363
"*.egg",
6464
".*",
6565
"_darcs",
66-
"build",
6766
"CVS",
68-
"dist",
6967
"node_modules",
7068
"venv",
7169
"{arch}",

testing/test_collection.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,19 @@ def test_foo():
135135

136136

137137
class TestCollectFS:
138+
def test_build_conditional_ignore(self, pytester: Pytester) -> None:
139+
tmp_path = pytester.path
140+
ensure_file(tmp_path / "build" / "test_found.py")
141+
ensure_file(tmp_path / "dist" / "test_found.py")
142+
for x in tmp_path.rglob("test_*.py"):
143+
x.write_text("def test_hello(): pass", encoding="utf-8")
144+
145+
result = pytester.runpytest("--collect-only")
146+
s = result.stdout.str()
147+
assert "test_found" in s
148+
138149
def test_ignored_certain_directories(self, pytester: Pytester) -> None:
139150
tmp_path = pytester.path
140-
ensure_file(tmp_path / "build" / "test_notfound.py")
141-
ensure_file(tmp_path / "dist" / "test_notfound.py")
142151
ensure_file(tmp_path / "_darcs" / "test_notfound.py")
143152
ensure_file(tmp_path / "CVS" / "test_notfound.py")
144153
ensure_file(tmp_path / "{arch}" / "test_notfound.py")

0 commit comments

Comments
 (0)