ci(test): import-guarded conftest + split root/tracker pytest jobs (follow-up 19 done)
This commit is contained in:
1 parent
0af22f1783
commit
30f550e489
3 files changed
+42
-4
No files matched your search
@@ -20,8 +20,8 @@ jobs:
|
||||
- name: Test
|
||||
run: ctest --test-dir build/linux --output-on-failure
|
||||
|
||||
python-tracker:
|
||||
name: Python tracker (pytest)
|
||||
python-root:
|
||||
name: Python root tests (pytest, no tracker deps)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -30,5 +30,23 @@ jobs:
|
||||
python-version: '3.12'
|
||||
- name: Install pytest
|
||||
run: python -m pip install --upgrade pip pytest
|
||||
- name: Run pytest
|
||||
- name: Run root-satisfiable pytest
|
||||
# conftest.py skips tests/test_tracker.py here (needs numpy/cv2/mediapipe,
|
||||
# only installed in tracker/.venv below); it collects fully there instead.
|
||||
run: pytest -q
|
||||
|
||||
python-tracker:
|
||||
name: Python tracker (pytest, tracker/.venv)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Create tracker venv and install deps
|
||||
run: |
|
||||
python -m venv tracker/.venv
|
||||
tracker/.venv/bin/pip install --upgrade pip
|
||||
tracker/.venv/bin/pip install pytest numpy opencv-python-headless mediapipe
|
||||
- name: Run tracker pytest
|
||||
run: tracker/.venv/bin/python -m pytest -q tests/
|
||||
@@ -300,7 +300,7 @@ Your next move: run the default-on high-accuracy review (in progress), then exec
|
||||
Commit: Y | docs(setup): linux + windows setup, calibration, troubleshooting
|
||||
Recommended task executor category: writing - documentation + packaging.
|
||||
|
||||
- [ ] 19. CI test-path split so the root venv does not collection-error on tracker tests
|
||||
- [x] 19. CI test-path split so the root venv does not collection-error on tracker tests
|
||||
What to do: add pytest testpaths config (pyproject.toml/pytest.ini/conftest) so `pytest` from the repo root does NOT collect tests/test_tracker.py (which needs tracker/.venv's numpy/cv2/mediapipe); root CI covers test_record_replay + the C-contract mirror, tracker/.venv covers tracker tests. Update .github/workflows/ci.yml accordingly.
|
||||
Closes: follow-up from the Wave 3 verifier (CI hygiene; non-blocking).
|
||||
Recommended task executor category: quick
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
"""Root pytest config (plan follow-up todo 19: CI test-path split).
|
||||
|
||||
tests/test_tracker.py imports numpy/cv2/mediapipe, which live only in
|
||||
tracker/.venv, not the root .venv used for the C-contract mirror tests
|
||||
(test_contract_py.py, test_record_replay.py, test_smoke.py). Running bare
|
||||
pytest from the repo root with the root venv must not collection-error on
|
||||
that import, so skip collecting test_tracker.py whenever the tracker's CV
|
||||
stack isn't importable. Under tracker/.venv the imports succeed and the full
|
||||
test set (including test_tracker.py) is collected and run normally -- see
|
||||
.github/workflows/ci.yml for the two separate CI steps.
|
||||
"""
|
||||
|
||||
try:
|
||||
import cv2 # noqa: F401
|
||||
import mediapipe # noqa: F401
|
||||
import numpy # noqa: F401
|
||||
|
||||
collect_ignore = []
|
||||
except ImportError:
|
||||
collect_ignore = ["tests/test_tracker.py"]
|
||||
Reference in new issue
Block a user