Skip to content

test: add minimal headless smoke test and run it in CI (#28)#46

Open
kenlacroix wants to merge 1 commit into
JanCBrammer:mainfrom
kenlacroix:test/ci-smoke
Open

test: add minimal headless smoke test and run it in CI (#28)#46
kenlacroix wants to merge 1 commit into
JanCBrammer:mainfrom
kenlacroix:test/ci-smoke

Conversation

@kenlacroix

Copy link
Copy Markdown

Closes #28 — adds a minimal smoke test and runs it in CI.

What's added

  • test/test_smoke.py — exercises the basic, GUI-free logic without opening a window or needing a Bluetooth sensor: utils.sign, the tick ⇄ breathing_rate roundtrip and bounds (config), valid_address(get_sensor_address(MockSensor())), Pacer radius/points within the unit disk, Model buffer construction, and Model.update_ibis_buffer outlier correction (absurd IBI clamped, plausible IBI passes through).
  • test/conftest.py — sets QT_QPA_PLATFORM=offscreen before any QApplication is created, plus a session-scoped offscreen QApplication fixture (the Model/Pacer QObjects need a running app, but no real window is shown).
  • .github/workflows/test.yml — runs on push/PR (+ manual): installs headless Qt libs, pip install -e .[test], pytest. Mirrors the existing build.yml style.
  • pyproject.toml — a test extra (pytest) and pytest config.

Why it's headless-safe

Qt uses the offscreen platform plugin (set in both the workflow env and conftest.py before QApplication), so no display server is needed. The test reuses the in-repo MockSensor, so no Bluetooth. The GUI-launching test/app.py:main() is never collected.

Notes

  • The issue referenced openhrv/test_app.py, which doesn't exist; the real tests live under test/, so the smoke test was added there.
  • MockSensor is imported as a top-level app module (the test/ dir is on sys.path via conftest.py) rather than from test.app import …, which would collide with the Python standard library's test package and fail collection.

Verified locally: QT_QPA_PLATFORM=offscreen pytest6 passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add minimal test to CI

1 participant