Skip to content

Commit 0897686

Browse files
committed
fix: ruff violations in api/server.py and test_db_lock_guard.py
- Remove unused get_decision_log import from server.py (F401) - Remove unused open_db import from test_db_lock_guard.py (F401) - Fix import sort order in test_db_lock_guard.py (I001) - Remove unused original_monotonic variable (F841) - Tighten pytest.raises(Exception) to pytest.raises(duckdb.Error) (B017)
1 parent b96e16c commit 0897686

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

packages/quant_pod/api/server.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646

4747
from quant_pod.audit.decision_log import (
4848
extract_indicator_attributions,
49-
get_decision_log,
5049
get_decision_log_readonly,
5150
)
5251
from quant_pod.audit.models import AuditQuery

tests/quant_pod/test_db_lock_guard.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717

1818
import duckdb
1919
import pytest
20-
2120
from quant_pod.db import (
2221
_connect_with_lock_guard,
2322
_is_process_alive,
24-
open_db,
2523
open_db_readonly,
2624
reset_connection,
2725
reset_connection_readonly,
@@ -123,10 +121,6 @@ def test_stale_lock_deadline_exceeded_raises(self):
123121
def always_lock(_path, **_kw):
124122
raise _lock_exc(dead_pid)
125123

126-
import time as _time
127-
128-
# Make monotonic always return a value past the deadline on first check
129-
original_monotonic = _time.monotonic
130124
with (
131125
patch("quant_pod.db.duckdb.connect", side_effect=always_lock),
132126
patch("quant_pod.db._is_process_alive", return_value=False),
@@ -194,8 +188,8 @@ def test_succeeds_when_file_exists(self, tmp_path):
194188
result = ro_conn.execute("SELECT COUNT(*) FROM foo").fetchone()
195189
assert result is not None
196190

197-
# Writes must fail
198-
with pytest.raises(Exception):
191+
# Writes must fail — DuckDB raises an error on read-only connections
192+
with pytest.raises(duckdb.Error):
199193
ro_conn.execute("INSERT INTO foo VALUES (1)")
200194

201195
def test_memory_path_returns_writable_connection(self):

0 commit comments

Comments
 (0)