@@ -277,7 +277,7 @@ def test_missing_permissions_on_unselected_directory_doesnt_crash(
277
277
known_build_dirs = pytest .mark .parametrize ("build_dir" , ["build" , "dist" ])
278
278
279
279
@known_build_dirs
280
- def test_build_dirs_collected_when_setuptools_setup_py_present (
280
+ def test_build_dirs_ignored_when_setuptools_setup_py_present (
281
281
self , pytester : Pytester , build_dir : str
282
282
) -> None :
283
283
tmp_path = pytester .path
@@ -297,8 +297,11 @@ def test_build_dirs_collected_when_setuptools_setup_py_present(
297
297
result = pytester .runpytest ("--collect-only" ).stdout .str ()
298
298
assert "test_module" not in result
299
299
300
+ result = pytester .runpytest ("--collect-only" , "--collect-in-build" ).stdout .str ()
301
+ assert "test_module" in result
302
+
300
303
@known_build_dirs
301
- def test_build_dirs_collected_when_setuptools_present_in_pyproject_toml (
304
+ def test_build_dirs_ignored_when_setuptools_present_in_pyproject_toml (
302
305
self , pytester : Pytester , build_dir : str
303
306
) -> None :
304
307
tmp_path = pytester .path
@@ -321,6 +324,9 @@ def test_build_dirs_collected_when_setuptools_present_in_pyproject_toml(
321
324
result = pytester .runpytest ("--collect-only" ).stdout .str ()
322
325
assert "test_module" not in result
323
326
327
+ result = pytester .runpytest ("--collect-only" , "--collect-in-build" ).stdout .str ()
328
+ assert "test_module" in result
329
+
324
330
325
331
class TestCollectPluginHookRelay :
326
332
def test_pytest_collect_file (self , pytester : Pytester ) -> None :
0 commit comments