Change chocolatey system test to ensure uv uses the right python (#17533)

Fix #17524.

This adds a couple of new options to `scripts/check_system_python.py` to verify that it is running with the right interpreter version and that it would hopefully be the interpreter picked up by uv (although that isn't strictly necessary as other tests should fail in that case).

Additionally, since the path to the newly installed chocolatey python is not loaded from registry on every step, we now manually load it.

Beware, this will break `GITHUB_PATH` but this job wasn't using it at the moment.
This commit is contained in:
Tomasz Kramkowski
2026-01-20 16:02:14 +00:00
committed by GitHub
parent ba534b1038
commit cfd048aa7a
2 changed files with 43 additions and 5 deletions
+9 -5
View File
@@ -523,24 +523,28 @@ jobs:
timeout-minutes: 10
name: "python3.9 via chocolatey"
runs-on: windows-latest
env:
TEST_PYTHON_VERSION: "3.9.13"
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: "Install Python"
run: choco install python3 --verbose --version=3.9.13
run: choco install python3 --verbose --version=$env:TEST_PYTHON_VERSION
- name: "Download binary"
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: uv-windows-x86_64-${{ inputs.sha }}
- name: "Print Python path"
run: echo $(which python3)
# Chocolatey updates the registry but doesn't update `GITHUB_PATH` and since figuring out what
# it added would be more work than it's worth, it's simpler to just reload the values from the
# registry.
- name: "Validate global Python install"
run: py -3.9 ./scripts/check_system_python.py --uv ./uv.exe
run: |
$env:PATH = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
python ./scripts/check_system_python.py --uv ./uv.exe --check-python-version $env:TEST_PYTHON_VERSION --check-path
system-test-pyenv:
timeout-minutes: 10