test_codeowners_last_match_wins_with_all_its_owners¶
Tests › tests/test_owners.py
What this test is for
Why it exists
GitHub: "the last matching pattern takes the most precedence"; every owner on it applies.
Verifies REQ-DDB-INDEX-007
Given
- —
When
rules = parse_codeowners("* @all\n/src/ @core @lead\n*.md @docs\n")codeowners_for(rules, "src/a.c")codeowners_for(rules, "src/README.md")codeowners_for(rules, "tools/x.py")
Then
- ✓ codeowners_for(rules, "src/a.c") equals (["@core", "@lead"], 2)
- ✓ codeowners_for(rules, "src/README.md") equals (["@docs"], 3)
- ✓ codeowners_for(rules, "tools/x.py") equals (["@all"], 1)
tests/test_owners.py:18 · its file's page
What it checks (3)
assert codeowners_for(rules, "src/a.c") == (["@core", "@lead"], 2)observescodeowners_forassert codeowners_for(rules, "src/README.md") == (["@docs"], 3)observescodeowners_forassert codeowners_for(rules, "tools/x.py") == (["@all"], 1)observescodeowners_for
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
test_codeowners_last_match_wins_with_all_its_owners→parse_codeowners→codeowners_forWhat it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Requirements it verifies (1)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-INDEX-007 | catalog | unknown |