Skip to content

Commit f3db4d8

Browse files
committed
Run pytest from RUNNER_TEMP so installed wheel is resolved
pytest's rootdir inference added `sdk/python/` to sys.path, so `from offbit_reflow import _native` resolved to the source directory (Python shim only) instead of site-packages (where `_native.so` actually lives). Cd'ing to `$RUNNER_TEMP` before running pytest drops the source dir from sys.path and the installed wheel takes over.
1 parent 47aa4db commit f3db4d8

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

.github/workflows/ci-python.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,10 @@ jobs:
5858
# Install whatever wheel was produced for the active interpreter.
5959
python -m pip install --force-reinstall sdk/python/dist/*.whl
6060
- name: Run tests
61-
working-directory: sdk/python
62-
run: python -m pytest -q
61+
shell: bash
62+
# Run from a tmpdir so the source `sdk/python/offbit_reflow`
63+
# directory isn't picked up by pytest's sys.path insertion —
64+
# we want imports to resolve to the wheel installed above.
65+
run: |
66+
cd "$RUNNER_TEMP"
67+
python -m pytest -q "$GITHUB_WORKSPACE/sdk/python/tests"

.github/workflows/publish-python.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ jobs:
144144
run: |
145145
python -m pip install --upgrade pip pytest
146146
python -m pip install --find-links dist 'offbit-reflow'
147-
python -m pytest -q sdk/python/tests
147+
# Run from a tmpdir so pytest resolves `offbit_reflow` from
148+
# site-packages, not from the source directory (which only
149+
# carries the Python shim, not `_native.so`).
150+
cd "$RUNNER_TEMP"
151+
python -m pytest -q "$GITHUB_WORKSPACE/sdk/python/tests"
148152
149153
publish:
150154
name: publish to PyPI

0 commit comments

Comments
 (0)