Skip to content

Commit 7ec99bc

Browse files
committed
Fix test job to use installed wheel, not source directory
The test was importing from the source checkout instead of the installed wheel. Fixed by: - Running import test from /tmp to avoid source shadowing - Using sparse checkout to only get tests directory - Running pytest from /tmp pointing to tests
1 parent 95cf38a commit 7ec99bc

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/build-wheels.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,14 @@ jobs:
4444
4545
- name: Build wheel
4646
env:
47-
CFD_ROOT: ./cfd
47+
CFD_ROOT: ${{ github.workspace }}/cfd
4848
CFD_STATIC_LINK: "ON"
49-
CFD_USE_STABLE_ABI: "OFF"
5049
run: |
51-
python -m build --wheel
50+
echo "CFD_ROOT=$CFD_ROOT"
51+
echo "Checking CFD library location..."
52+
ls -la $CFD_ROOT/build/lib/ || echo "Library dir not found"
53+
# Use pip wheel to build, which respects env vars better
54+
pip wheel . --no-deps --wheel-dir dist/
5255
echo "=== Wheel built ==="
5356
ls -la dist/
5457
@@ -70,8 +73,6 @@ jobs:
7073
runs-on: ubuntu-latest
7174

7275
steps:
73-
- uses: actions/checkout@v4
74-
7576
- name: Set up Python 3.8
7677
uses: actions/setup-python@v5
7778
with:
@@ -90,6 +91,8 @@ jobs:
9091
9192
- name: Test import
9293
run: |
94+
# Run from temp dir to avoid importing from source
95+
cd /tmp
9396
python -c "
9497
import cfd_python
9598
print('Package loaded:', cfd_python.__file__)
@@ -99,5 +102,14 @@ jobs:
99102
print('Solvers:', cfd_python.list_solvers())
100103
"
101104
105+
# Checkout only tests directory for running tests
106+
- uses: actions/checkout@v4
107+
with:
108+
sparse-checkout: tests
109+
sparse-checkout-cone-mode: false
110+
102111
- name: Run tests
103-
run: pytest tests/ -v
112+
run: |
113+
# Run from a different directory to use installed package
114+
cd /tmp
115+
pytest $GITHUB_WORKSPACE/tests/ -v

0 commit comments

Comments
 (0)