Skip to content

Commit 01fae08

Browse files
rootroot
authored andcommitted
Add test for ignore when setup.py present
1 parent 67bf34a commit 01fae08

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

testing/test_collection.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def test_foo():
135135

136136

137137
class TestCollectFS:
138-
def test_build_conditional_ignore(self, pytester: Pytester) -> None:
138+
def test_build_dirs_collected(self, pytester: Pytester) -> None:
139139
tmp_path = pytester.path
140140
ensure_file(tmp_path / "build" / "test_found.py")
141141
ensure_file(tmp_path / "dist" / "test_found.py")
@@ -146,6 +146,19 @@ def test_build_conditional_ignore(self, pytester: Pytester) -> None:
146146
s = result.stdout.str()
147147
assert "test_found" in s
148148

149+
def test_build_ignored_if_setuptools(self, pytester: Pytester) -> None:
150+
tmp_path = pytester.path
151+
ensure_file(tmp_path / "build" / "test_notfound.py")
152+
ensure_file(tmp_path / "dist" / "test_notfound.py")
153+
for x in tmp_path.rglob("test_*.py"):
154+
x.write_text("def test_hello(): pass", encoding="utf-8")
155+
156+
ensure_file(tmp_path / "setup.py")
157+
158+
result = pytester.runpytest("--collect-only")
159+
s = result.stdout.str()
160+
assert "test_notfound" not in s
161+
149162
def test_ignored_certain_directories(self, pytester: Pytester) -> None:
150163
tmp_path = pytester.path
151164
ensure_file(tmp_path / "_darcs" / "test_notfound.py")

0 commit comments

Comments
 (0)