test_locks_held_when_answers_the_question_L1_could_not

Tests › tests/test_critical_sections.py

passed Passed in the packaged run.

What this test is for

Why it exists

`enqueue` is called from inside `writer`'s hold of Owner::mutex_, so calling it means contending for a lock its own signature never mentions. The whole section comes back, not just the matching call, because "what else runs under the lock I am about to contend for" is the next question.

Given

  1. —
→

When

  1. held = locks_held_when(_query_db(), "enqueue")
→

Then

  1. ✓ [(s.lock, s.lock_scope, s.holder) for s in held] equals [("mutex_", "class:Owner", "writer")]
  2. ✓ [c.callee for c in held[0].calls] equals ["enqueue", "memcpy"]

What it exercises

The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.

clew — `main` (clew/cli.py) · 1 of 400 steps

… 352 earlier steps

command-line usercommand-line usercommand-line usercommand-line userclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesmain353–354. lock_roster → nestings_on353nestings_on +1 more355. _layer_present → table_exists355table_exists▶ test enters356. nestings_on → table_exists356table_exists357. lock_roster → _nesting_pairs357_nesting_pairs

… 43 later steps

1 more

tests/test_critical_sections.py:481 · its file's page

What it checks (2)

  1. assert [(s.lock, s.lock_scope, s.holder) for s in held] == [("mutex_", "class:Owner", "writer")] observes locks_held_when via held
  2. assert [c.callee for c in held[0].calls] == ["enqueue", "memcpy"] observes locks_held_when via held

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_locks_held_when_answers_the_question_L1_could_not→locks_held_when→_query_db

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.

test_locks_held_when_answers_the_question_L1_could_not · 2 checkslocks_held_whenconnectREQ-DDB-QUERY-001 · measuredlocks_held_whenrowids_for_nameREQ-DDB-QUERY-003 · measuredlocks_held_whenREQ-DDB-SCHEMA-011 · measured
Also reaches 4 requirements

Its run touches their code; that is reach, not proof.