Repository navigation
test(scripts): run only unit tests affected by changed files - #1065
greenc-FNAL wants to merge 1 commit into
Conversation
greenc-FNAL
commented
Nov 13, 2026
- Add a selector that maps changed source and configuration files to relevant test modules, falling back to the full suite for unmapped dependencies.
- Update the pre-commit hook to pass changed filenames to the selector, avoiding unrelated test runs.
- Add a selector that maps changed source and configuration files to relevant test modules, falling back to the full suite for unmapped dependencies. - Update the pre-commit hook to pass changed filenames to the selector, avoiding unrelated test runs.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 42 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #1065 +/- ##
==========================================
- Coverage 90.89% 86.46% -4.43%
==========================================
Files 181 13 -168
Lines 6027 1817 -4210
Branches 960 0 -960
==========================================
- Hits 5478 1571 -3907
+ Misses 351 246 -105
+ Partials 198 0 -198
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 193 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
|
||
| def test_changed_unmapped_script_code_selects_all_tests() -> None: | ||
| """Run all tests for script code not represented in the dependency map.""" | ||
| assert select_tests(["scripts/new_helper.py"]) == _all_tests() |
There was a problem hiding this comment.
Maybe this case should be an error? Or it should execute no tests?
There was a problem hiding this comment.
Unmapped script changes intentionally select all script tests. Without an explicit mapping, we cannot safely infer which tests are affected; selecting none could silently skip relevant coverage. Failing instead would impose a mapping requirement that is not part of the current contract. The existing regression test at scripts/test/test_run_script_tests.py:54-56 covers this fallback. The focused prek hook passed; direct pytest was unavailable because the system Python 3.12 lacks pytest.
knoepfel
left a comment
There was a problem hiding this comment.
@greenc-FNAL, thanks for the PR. Only one comment for your consideration.