Consider any test_*.py in subdirectories when a conftest.py file is changed

This commit is contained in:
Pedro Algarvio 2021-02-16 08:59:50 +00:00
parent 772f3a4332
commit 1fda51c346

View file

@ -1234,7 +1234,9 @@ def from_filenames_collection_modifyitems(config, items):
for path in from_filenames_paths:
if path.as_posix().startswith("tests/"):
if path.name == "conftest.py":
# This is not a test module
# This is not a test module, but consider any test_*.py files in child directories
for match in path.parent.rglob("test_*.py"):
test_module_paths.add(match)
continue
# Tests in the listing don't require additional matching and will be added to the
# list of tests to run