test_codeowners_patterns_follow_gitignore

Tests › tests/test_owners.py

passed Passed in the packaged run.

What this test is for

Why it exists

An unanchored name matches at any depth; a leading `/` anchors; `*` stays in one segment.

Verifies REQ-DDB-INDEX-007

Given

  1. —
→

When

  1. rules = parse_codeowners("docs/ @d\n/build/*.c @b\nlogs @l\n")
  2. codeowners_for(rules, "docs/x/y.md")
  3. codeowners_for(rules, "build/a.c")
2 more
  1. codeowners_for(rules, "build/sub/a.c")
  2. codeowners_for(rules, "app/logs/out.txt")
→

Then

  1. ✓ codeowners_for(rules, "docs/x/y.md") equals (["@d"], 1)
  2. ✓ codeowners_for(rules, "build/a.c") equals (["@b"], 2)
  3. ✓ codeowners_for(rules, "build/sub/a.c") is None
  4. ✓ codeowners_for(rules, "app/logs/out.txt") equals (["@l"], 3)

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

What it checks (4)

  1. assert codeowners_for(rules, "docs/x/y.md") == (["@d"], 1) observes codeowners_for
  2. assert codeowners_for(rules, "build/a.c") == (["@b"], 2) observes codeowners_for
  3. assert codeowners_for(rules, "build/sub/a.c") is None observes codeowners_for
  4. assert codeowners_for(rules, "app/logs/out.txt") == (["@l"], 3) 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_patterns_follow_gitignore→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