Skip to content

Commit

Permalink
Recurse into build / dist directories
Browse files Browse the repository at this point in the history
See pytest-dev#12625 for context
  • Loading branch information
root authored and root committed Oct 25, 2024
1 parent 26215b8 commit 67bf34a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/_pytest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ def pytest_addoption(parser: Parser) -> None:
"*.egg",
".*",
"_darcs",
"build",
"CVS",
"dist",
"node_modules",
"venv",
"{arch}",
Expand Down
13 changes: 11 additions & 2 deletions testing/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 67bf34a

Please sign in to comment.