test: add minimal headless smoke test and run it in CI (#28)#46
Open
kenlacroix wants to merge 1 commit into
Open
test: add minimal headless smoke test and run it in CI (#28)#46kenlacroix wants to merge 1 commit into
kenlacroix wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, thetick ⇄ breathing_rateroundtrip and bounds (config),valid_address(get_sensor_address(MockSensor())),Pacerradius/points within the unit disk,Modelbuffer construction, andModel.update_ibis_bufferoutlier correction (absurd IBI clamped, plausible IBI passes through).test/conftest.py— setsQT_QPA_PLATFORM=offscreenbefore anyQApplicationis created, plus a session-scoped offscreenQApplicationfixture (theModel/PacerQObjects 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 existingbuild.ymlstyle.pyproject.toml— atestextra (pytest) and pytest config.Why it's headless-safe
Qt uses the
offscreenplatform plugin (set in both the workflow env andconftest.pybeforeQApplication), so no display server is needed. The test reuses the in-repoMockSensor, so no Bluetooth. The GUI-launchingtest/app.py:main()is never collected.Notes
openhrv/test_app.py, which doesn't exist; the real tests live undertest/, so the smoke test was added there.MockSensoris imported as a top-levelappmodule (thetest/dir is onsys.pathviaconftest.py) rather thanfrom test.app import …, which would collide with the Python standard library'stestpackage and fail collection.Verified locally:
QT_QPA_PLATFORM=offscreen pytest→ 6 passed.