test_codeowners_last_match_wins_with_all_its_owners

Tests › tests/test_owners.py

passed Passed in the packaged run.

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

  1. —
→

When

  1. rules = parse_codeowners("* @all\n/src/ @core @lead\n*.md @docs\n")
  2. codeowners_for(rules, "src/a.c")
  3. codeowners_for(rules, "src/README.md")
  4. codeowners_for(rules, "tools/x.py")
→

Then

  1. ✓ codeowners_for(rules, "src/a.c") equals (["@core", "@lead"], 2)
  2. ✓ codeowners_for(rules, "src/README.md") equals (["@docs"], 3)
  3. ✓ codeowners_for(rules, "tools/x.py") equals (["@all"], 1)

tests/test_owners.py:18 · its file's page

What it checks (3)

  1. assert codeowners_for(rules, "src/a.c") == (["@core", "@lead"], 2) observes codeowners_for
  2. assert codeowners_for(rules, "src/README.md") == (["@docs"], 3) observes codeowners_for
  3. assert codeowners_for(rules, "tools/x.py") == (["@all"], 1) observes codeowners_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_for

What 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)

requirementlinked byimplementers exercised
REQ-DDB-INDEX-007catalogunknown