diff --git a/backend/tests/test_db_migrate.py b/backend/tests/test_db_migrate.py index ede3f1a..4b66327 100644 --- a/backend/tests/test_db_migrate.py +++ b/backend/tests/test_db_migrate.py @@ -115,12 +115,12 @@ def test_run_ignores_non_sql_files( assert _user_version(engine) == 1 -def test_migration_latest_idempotent_on_fresh_db() -> None: +def test_migration_latest_idempotent_on_fresh_db(tmp_path: Path) -> None: """All migrations up to the current head run cleanly on a fresh DB, and a second run is a no-op (no version bump). SP22 bumped the expected head from 14 to 15 with the new UNIQUE-drop migration. """ - engine = _fresh_engine(Path("/tmp/sp22_fresh_db_latest_test.db")) + engine = _fresh_engine(tmp_path) db_migrate.run(engine) v_after_first = _user_version(engine) assert v_after_first == 15, f"expected head=15, got {v_after_first}" @@ -161,7 +161,8 @@ def test_drop_claims_unique_constraint_migration(tmp_path: Path, monkeypatch: py # claims to batches still works after the recreation.) with engine.begin() as conn: conn.exec_driver_sql( - "INSERT INTO batches (id) VALUES ('B1')" + "INSERT INTO batches (id, kind, input_filename, parsed_at) " + "VALUES ('B1', '837p', 'test.txt', '2026-01-01 00:00:00')" ) conn.exec_driver_sql( "INSERT INTO claims (id, batch_id, patient_control_number, charge_amount) "