Tests clear flow tombstones between modules with the other engine rows, and the tombstone test commits its prune before checking the count, so a wrong count no longer holds the write lock over the tests after it

This commit is contained in:
2026-11-02 19:14:59 +01:00
parent d4a1b1db47
commit fd637e0f1e
2 changed files with 10 additions and 3 deletions
+6 -2
View File
@@ -36,8 +36,11 @@ def test_a_tombstone_stays_while_history_names_its_id(db: Session) -> None:
assert graves.recorded("wren_train") == "wren_train" # history, no tombstone
assert graves.recorded("f_nothing") is None
assert tombstones.prune(db) == 1
# Committed before it is checked, so a wrong count does not leave this
# session holding the write lock for every test after it.
pruned = tombstones.prune(db)
db.commit()
assert pruned == 1
kept = {stone.id for stone in db.exec(select(FlowTombstone))}
assert kept == {"f_gonegone", "f_trainee", "f_measured"}
@@ -45,8 +48,9 @@ def test_a_tombstone_stays_while_history_names_its_id(db: Session) -> None:
db.exec(delete(MetricBucket)) # type: ignore[call-overload]
db.exec(delete(EngineEvent)) # type: ignore[call-overload]
db.commit()
assert tombstones.prune(db) == 3
pruned = tombstones.prune(db)
db.commit()
assert pruned == 3
def test_a_name_comes_from_the_live_flow_then_its_tombstone_then_the_id(