Cause: api/data_io.py import_sql() depends on SQLAlchemy, but sqlalchemy is not listed in requirements.txt (CI installs pip install -r requirements.txt then -e .).
Also leaves uncovered: api/data_io.py lines 245–248 (engine connect / read_sql after successful import).
Failure 2 — coverage < 100%
| File |
Miss |
Lines |
api/data_io.py |
4 |
245–248 |
api/jobs.py |
4 |
485, 504–506 |
api/researcher_routes.py |
7 |
112–113, 137, 154, 166–167, 742 |
openhealth/trust_pack.py |
2 |
164, 166 |
| TOTAL |
17 |
99.38% |
Likely branches: CSV header parse failure, reconcile early-returns, HPO temporal_split → split_by_patient=False, SHAP purge/remirror, trust_pack mirror skip for missing/invalid PNG.
Expected
- CI green with
cov-fail-under=100
- Either SQLAlchemy is a declared CI/runtime dep, or the test mocks the ImportError path and separate tests cover the happy path when SQLAlchemy is present
Proposed fix
Notes
- Warnings (Starlette TestClient/
httpx, shap colormap, pandas copy=) are noise for this issue; track separately if desired.
- Local runs with
--no-cov may hide the coverage gate; CI uses pytest.ini defaults.
Acceptance criteria
Cause:
api/data_io.pyimport_sql()depends on SQLAlchemy, butsqlalchemyis not listed inrequirements.txt(CI installspip install -r requirements.txtthen-e .).Also leaves uncovered:
api/data_io.pylines 245–248 (engine connect /read_sqlafter successful import).Failure 2 — coverage < 100%
api/data_io.pyapi/jobs.pyapi/researcher_routes.pyopenhealth/trust_pack.pyLikely branches: CSV header parse failure, reconcile early-returns, HPO
temporal_split→split_by_patient=False, SHAP purge/remirror, trust_pack mirror skip for missing/invalid PNG.Expected
cov-fail-under=100Proposed fix
sqlalchemytorequirements.txt(orrequirements-dev.txt+ CI install) soimport_sqlworks in CItest_data_io_delete_symlink_and_importsexercises the success path (or split ImportError vs happy-path tests)jobsSHAP cleanup,trust_pack.mirror_to_sharedearly returns,researcher_routesheader/reconcile/HPO temporal_split)PYTHONPATH=. pytest tests/ -m "not e2e" -q --tb=short→ 0 fail, coverage ≥ 100%Notes
httpx, shap colormap, pandascopy=) are noise for this issue; track separately if desired.--no-covmay hide the coverage gate; CI usespytest.inidefaults.Acceptance criteria
ModuleNotFoundError: sqlalchemyin CItest_data_io_delete_symlink_and_importspassesapi,openhealth)