[loop-cycle-50] refactor: replace bare sqlite3.connect() with context managers batch 2 (#157) (#180)

This commit is contained in:
2026-03-15 11:58:43 -04:00
parent bea2749158
commit bcd6d7e321
16 changed files with 512 additions and 510 deletions

View File

@@ -216,21 +216,15 @@ class TestWALMode:
with patch("infrastructure.models.registry.DB_PATH", db):
from infrastructure.models.registry import _get_conn
conn = _get_conn()
try:
with _get_conn() as conn:
mode = conn.execute("PRAGMA journal_mode").fetchone()[0]
assert mode == "wal"
finally:
conn.close()
def test_registry_db_busy_timeout(self, tmp_path):
db = tmp_path / "wal_test.db"
with patch("infrastructure.models.registry.DB_PATH", db):
from infrastructure.models.registry import _get_conn
conn = _get_conn()
try:
with _get_conn() as conn:
timeout = conn.execute("PRAGMA busy_timeout").fetchone()[0]
assert timeout == 5000
finally:
conn.close()