Skip to content

Commit 06cc0fc

Browse files
Use python-version in setup-uv GitHub action and Consolidate CI steps (#999)
* Use `python-version` in setup-uv GitHub action and Consolidate CI steps * Override UV_PYTHON for the test suite
1 parent 674c339 commit 06cc0fc

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,14 @@ jobs:
4343
with:
4444
version: ${{ matrix.uv_version || 'latest' }}
4545
enable-cache: true
46-
47-
- name: Set up Python
48-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
49-
with:
5046
python-version: ${{ matrix.python_version }}
5147

52-
- name: Bump dependencies
53-
if: ${{ matrix.dependencies == 'max' }}
54-
run: |
55-
uv sync --upgrade
56-
5748
- name: Setup dependencies
5849
run: |
59-
uv python pin $CI_PYTHON_VERSION
60-
uv sync
50+
uv sync $CI_UV_UPGRADE_ARG
6151
env:
52+
CI_UV_UPGRADE_ARG: ${{ matrix.dependencies == 'max' && '--upgrade' || '' }}
6253
UV_RESOLUTION: ${{ matrix.dependencies == 'min' && 'lowest-direct' || 'highest' }}
63-
CI_PYTHON_VERSION: ${{ matrix.python_version }}
6454

6555
- name: Run prek
6656
if: ${{ matrix.pre_commit == null || matrix.pre_commit == 'true' }}

tests/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import shutil
23
from collections.abc import Generator
34
from enum import Enum
@@ -9,6 +10,11 @@
910
from usethis._integrations.backend.uv.call import call_subprocess, call_uv_subprocess
1011
from usethis._test import change_cwd, is_offline
1112

13+
if "UV_PYTHON" in os.environ:
14+
# To allow test subprocesses to use different versions of Python than the one
15+
# running the tests.
16+
del os.environ["UV_PYTHON"]
17+
1218

1319
@pytest.fixture(scope="session")
1420
def _uv_init_dir(tmp_path_factory: pytest.TempPathFactory) -> Path:

0 commit comments

Comments
 (0)