fix(sp22): correct test fixtures in SP22 migration tests
- test_migration_latest_idempotent_on_fresh_db now uses the pytest tmp_path fixture instead of a literal /tmp path that did not exist, so sqlite can create the test DB. - test_drop_claims_unique_constraint_migration now inserts the NOT NULL batches.kind / input_filename / parsed_at columns when seeding the parent row for the two same-PCN claims.
This commit is contained in:
@@ -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) "
|
||||
|
||||
Reference in New Issue
Block a user