Skip to content

Commit 58030a5

Browse files
committed
fix(ci): activate virtual environment for pytest and prek
Add venv activation step that adds .venv/bin (or Scripts on Windows) to GITHUB_PATH. This ensures non-uv tools like pytest and prek use the correct Python interpreter and installed packages from the virtual environment. Without this, pytest and prek would use the system Python and not find the test dependencies installed by uv pip.
1 parent 07fcdef commit 58030a5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

.github/workflows/tests.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ jobs:
3232
python-version: ${{ matrix.python-version }}
3333
- name: Create virtual environment
3434
run: uv venv
35+
- name: Activate virtual environment
36+
run: |
37+
if [ "$RUNNER_OS" == "Windows" ]; then
38+
echo "$GITHUB_WORKSPACE/.venv/Scripts" >> $GITHUB_PATH
39+
else
40+
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
41+
fi
42+
shell: bash
3543
- name: Install Package
3644
run: uv pip install ".[test]"
3745
- name: Run pytest
@@ -51,6 +59,8 @@ jobs:
5159
install-only: true
5260
- name: Create virtual environment
5361
run: uv venv
62+
- name: Activate virtual environment
63+
run: echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
5464
- name: Install Package
5565
run: uv pip install ".[test]"
5666
- name: run prek with plugin

0 commit comments

Comments
 (0)