forked from Rockachopa/Timmy-time-dashboard
[loop-cycle-50] refactor: replace bare sqlite3.connect() with context managers batch 2 (#157) (#180)
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user