Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
"tests/sentry/test_wsgi.py",
}

# Non-source files that don't appear in coverage data but have known test
# dependencies. When one of these files is changed, the mapped test files
# are added to the selected set so selective testing covers them without
# falling back to a full suite run.
EXTRA_FILE_TO_TEST_MAPPING: dict[str, list[str]] = {
".github/CODEOWNERS": ["tests/sentry/api/test_api_owners.py"],
}


def _matches_trigger(file_path: str, trigger: str | re.Pattern[str]) -> bool:
if isinstance(trigger, re.Pattern):
Expand Down Expand Up @@ -137,6 +145,13 @@ def main() -> int:

affected_test_files -= EXCLUDED_TEST_FILES

# Include tests for non-source files with known test dependencies
for file_path in changed_files:
mapped_tests = EXTRA_FILE_TO_TEST_MAPPING.get(file_path, [])
if mapped_tests:
print(f"Including {len(mapped_tests)} mapped test files for {file_path}")
affected_test_files.update(mapped_tests)

# Also include any test files that were directly changed/added in the PR
changed_test_files = get_changed_test_files(changed_files)
if changed_test_files:
Expand Down
Loading