Skip to main content

Testing and Continuous Integration

Testing Strategy

The complete software only runs when OPUS and CamTracker are installed and an EM27 is connected. However, in test mode, the software can run independently without interacting with any modules requiring a particular setup. Most functionality is tested by running the software and conducting measurements. Since Pyra only starts/stops the measurement process but does not affect output files, these output files from OPUS do not have to be tested.

Testing with Pytest

Testing is done using PyTest. All tests can be found in the tests/ directory. There are two types of test functions:

# can be run without config.json/hardware setup
@pytest.mark.ci
def test_something():
pass

# require config.json and hardware setup
@pytest.mark.integration
def test_something_else():
pass

Run the two test categories with:

python -m pytest -m "ci" tests
python -m pytest -m "integration" tests

The following can be used to test whether emailing and uploading is configured correctly:

python -m pytest tests/integration/test_emailing.py
python -m pytest tests/integration/test_upload.py

Static Typing for Pyra Core and CLI

All our python code contains static type annotations. We are using MyPy to test the code's integrity. Run this analysis using:

bash scripts/run_type_analysis.sh

We are using the strict MyPy settings with a few exceptions that can be found in pyproject.toml.

Static Typing for Pyra UI

The whole frontend is written in Typescript. Testing the code's integrity can be done by building the UI:

cd packages/ui
yarn build

Continuous Integration

Test on Main: Will run all CI tests, MyPy, and build the UI on every commit on main or every PR on main.

Build on Prerelease: Will build the UI and generates a release named "vX.Y.Z-prerelease (generated by CI)" that has the .msi file attached to it on every commit on prerelease.

Build on Release: Will build the UI and generates a release named "vX.Y.Z (generated by CI)" that has the .msi file attached to it on every commit on release.

info

The release branch should only contain code from the latest official release. Use the prerelease branch to bundle the installable UI on demand.