@@ -135,7 +135,7 @@ def test_foo():
135135
136136
137137class 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,32 @@ def test_build_conditional_ignore(self, pytester: Pytester) -> None:
146146 s = result .stdout .str ()
147147 assert "test_found" in s
148148
149+ def test_setuptools_ignored_if_present (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+
162+ def test_setuptools_ignored_pyproject_toml (self , pytester : Pytester ) -> None :
163+ tmp_path = pytester .path
164+ ensure_file (tmp_path / "build" / "test_notfound.py" )
165+ ensure_file (tmp_path / "dist" / "test_notfound.py" )
166+ for x in tmp_path .rglob ("test_*.py" ):
167+ x .write_text ("def test_hello(): pass" , encoding = "utf-8" )
168+
169+ ensure_file (tmp_path / "pyproject.toml" )
170+
171+ result = pytester .runpytest ("--collect-only" )
172+ s = result .stdout .str ()
173+ assert "test_notfound" not in s
174+
149175 def test_ignored_certain_directories (self , pytester : Pytester ) -> None :
150176 tmp_path = pytester .path
151177 ensure_file (tmp_path / "_darcs" / "test_notfound.py" )
0 commit comments