Skip to content

refactor: consume psyexp-core for shared experiment infrastructure #40

refactor: consume psyexp-core for shared experiment infrastructure

refactor: consume psyexp-core for shared experiment infrastructure #40

Workflow file for this run

name: tests
on:
push:
pull_request:
jobs:
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
# Octave is the reference engine for the calibration MATLAB-parity test
# (tests/test_calibration_matlab_parity.py). Without it that test skips
# with a loud warning, so installing it here is what makes the parity
# check actually run in CI.
- name: Install Octave
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends octave
octave --version | head -1
- name: Install uv
uses: astral-sh/setup-uv@v7
# PsychoPy is deliberately NOT installed: it's a heavy GUI/audio dep whose
# transitive build (ffpyplayer → SDL headers) is fragile on headless CI.
# The source modules guard their psychopy imports (try/except), so the
# whole test suite imports and runs without it; only pandas is needed at
# runtime (sequences.py). We install just that + pytest and put `src` on
# PYTHONPATH rather than resolving the project's full dependency graph.
#
# psyexp-core is installed --no-deps for the same reason: the light modules
# the tests pull in (recording / manifest / rundir / diagnostics / keyboard)
# are import-clean without PsychoPy, so --no-deps avoids dragging the GUI
# stack back in. Its pinned source is read from uv.lock via `uv export`
# rather than hardcoding the git ref here — the lockfile stays the single
# source of truth.
- name: Create venv and install minimal test deps
run: |
uv venv
uv pip install pytest pandas
uv export --frozen --no-hashes --no-emit-project | grep '^psyexp-core @' > psyexp-core-req.txt
uv pip install --no-deps -r psyexp-core-req.txt
# tests/test_overlay.py is excluded: it's not an automated test (no test
# functions) but a manual `visual.Window` script that needs a live display
# and imports psychopy at module top. Everything else runs headless, incl.
# the MATLAB-parity test (Octave installed above lets it run, not skip).
- name: Run tests
env:
PYTHONPATH: src
run: .venv/bin/python -m pytest -v --ignore=tests/test_overlay.py