Skip to content

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

Merged
EliteTK merged 2 commits intomainfrom
tk/fix-ci-system-chocolatey
Jan 20, 2026
Merged

Change chocolatey system test to ensure uv uses the right python#17533
EliteTK merged 2 commits intomainfrom
tk/fix-ci-system-chocolatey

Conversation

@EliteTK
Copy link
Contributor

@EliteTK EliteTK commented Jan 16, 2026

Summary

Fix #17524.

Test Plan

N/A

@EliteTK EliteTK added bug Something isn't working test:system Enable system tests for a pull request labels Jan 16, 2026
@EliteTK EliteTK marked this pull request as ready for review January 16, 2026 17:47
@EliteTK EliteTK requested a review from zanieb January 16, 2026 17:47
@EliteTK EliteTK marked this pull request as draft January 16, 2026 17:48
@EliteTK
Copy link
Contributor Author

EliteTK commented Jan 16, 2026

Seems like the python path printing is borked now...

@EliteTK EliteTK force-pushed the tk/fix-ci-system-chocolatey branch from a502bbe to 8c6aba6 Compare January 16, 2026 17:51
@EliteTK EliteTK marked this pull request as ready for review January 16, 2026 17:56
@zanieb
Copy link
Member

zanieb commented Jan 16, 2026

I think using UV_TEST_PYTHON_PATH isn't okay in the context of the system tests.

@zanieb
Copy link
Member

zanieb commented Jan 16, 2026

I think the interpreter that invokes the system test script is the one that should be used, right?

@EliteTK
Copy link
Contributor Author

EliteTK commented Jan 16, 2026

The test script interpreter is the one whose parent directory I am putting in UV_TEST_PYTHON_PATH. Although I agree it's kind of jank in retrospect. It could hide a bug in our path parsing.

As an alternative we could prepend to $env:PATH 1 before running the script.

I think the real weird thing here is that there's no actual guarantee that py -3.9 would pick the chocolatey version if some other 3.9 was installed, but I couldn't find any good way to verify this invariant.

But at least I feel that setting $env:PATH prior to running the verification script would at least ensure that the script and uv both use the same python version.

Lastly, I could try to investigate why chocolatey's path changes aren't being picked up although I have a feeling that the answer is going to be either: "the registry changes can't be propagated to the runner without restarting the runner" or "github runners explicitly sanitize that somehow so the environment change doesn't persist".

Footnotes

  1. GITHUB_PATH seems to be for appending only, which isn't helpful here.

@zanieb
Copy link
Member

zanieb commented Jan 16, 2026

I think the real weird thing here is that there's no actual guarantee that py -3.9 would pick the chocolatey version if some other 3.9 was installed, but I couldn't find any good way to verify this invariant.

Can't we just use the path that chocolatey is at instead of py -3.9? Maybe I'm missing something?

@zanieb
Copy link
Member

zanieb commented Jan 16, 2026

But yeah I think a point of these tests is uv's discovery of system Python versions, so overriding that with our custom test path seems janky. That variable shouldn't really be used in more places, it's quite the blemish already imo (I added it, alas)

@EliteTK
Copy link
Contributor Author

EliteTK commented Jan 16, 2026

Can't we just use the path that chocolatey is at instead of py -3.9? Maybe I'm missing something?

Yeah, sorry, I just realised there was a key bit of context I forgot:

It seems you can tell chocolatey where you'd like to put the installation, but it won't listen if that version is already installed (it will overwrite at the existing location). There also doesn't seem to be any good way of asking chocolatey where it did install it either.

This means using C:\Python39\ (the default path) could break if we revert the runner image or a future image starts shipping python 3.9 again.

But, having thought about it, prepending C:\Python39\ and then using C:\Python39\python.exe .\script is probably the safest option: it will fail if anything weird happens to the image which could cause us to e.g. start testing a non-chocolatey python version.

What might also work: We could try to set $env:PATH from the registry and invoke python instead of py -3.9. But we'd have to verify the version matches what we expect.

@EliteTK EliteTK temporarily deployed to uv-test-publish January 19, 2026 14:12 — with GitHub Actions Inactive
@EliteTK EliteTK force-pushed the tk/fix-ci-system-chocolatey branch from e822878 to 67edeea Compare January 19, 2026 14:22
@EliteTK EliteTK force-pushed the tk/fix-ci-system-chocolatey branch from 67edeea to ea5d8be Compare January 19, 2026 15:14
@EliteTK EliteTK changed the title Set UV_TEST_PYTHON_PATH for the chocolatey system test to ensure uv uses the right python Change chocolatey system test to ensure uv uses the right python Jan 19, 2026
@EliteTK
Copy link
Contributor Author

EliteTK commented Jan 20, 2026

@zanieb I went with the approach of refreshing the path from the registry. Although this means that GITHUB_PATH won't work properly...

Comment on lines 544 to 549
echo $(which python)
$version = python --version
if ($version -ne "Python $env:TEST_PYTHON_VERSION") {
echo "Expected Python $env:TEST_PYTHON_VERSION, got $version"
exit 1
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just put this into check_system_python.py with a --python-version flag?

@EliteTK EliteTK force-pushed the tk/fix-ci-system-chocolatey branch from 02cad7c to e8b47ec Compare January 20, 2026 15:42
@EliteTK EliteTK force-pushed the tk/fix-ci-system-chocolatey branch from e8b47ec to efe8e68 Compare January 20, 2026 15:53
@EliteTK EliteTK enabled auto-merge (squash) January 20, 2026 15:56
@EliteTK EliteTK merged commit cfd048a into main Jan 20, 2026
78 of 79 checks passed
@EliteTK EliteTK deleted the tk/fix-ci-system-chocolatey branch January 20, 2026 16:02
@EliteTK
Copy link
Contributor Author

EliteTK commented Jan 20, 2026

Dang it... It merges automatically even if system tests fail?

@konstin
Copy link
Member

konstin commented Jan 20, 2026

GitHub auto-merge can unfortunately only be configured on the required checks.

EliteTK added a commit that referenced this pull request Jan 20, 2026
## Summary

Fix a bug in #17533 which was auto-merged despite failures.

## Test Plan

N/A (CI PR).
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jan 27, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.9.26` → `0.9.27` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>astral-sh/uv (astral-sh/uv)</summary>

### [`v0.9.27`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0927)

[Compare Source](astral-sh/uv@0.9.26...0.9.27)

Released on 2026-01-26.

##### Python

- Upgrade Pyodide to 0.29.2 ([#&#8203;17652](astral-sh/uv#17652))
- Upgrade to GraalPy 25.0.2 ([#&#8203;17634](astral-sh/uv#17634))

##### Enhancements

- Add `-t` shortform for `--target` to `uv pip` subcommands ([#&#8203;17501](astral-sh/uv#17501))
- Add support for ROCm 7.0 and 7.1 accelerator backends ([#&#8203;17681](astral-sh/uv#17681))
- Further improve free-threading ABI incompatibility errors ([#&#8203;17491](astral-sh/uv#17491))
- Implement `uv pip freeze --exclude` flag ([#&#8203;17045](astral-sh/uv#17045))
- Improve warnings for `--system` and `--no-system` in `uv venv` ([#&#8203;17647](astral-sh/uv#17647))
- Make `uv pip compile` attempt to download a specified `--python-version` if it can. ([#&#8203;17249](astral-sh/uv#17249))
- Support Trusted Publishing with pyx ([#&#8203;17438](astral-sh/uv#17438))
- Fix JSON schema for `exclude-newer-package` ([#&#8203;17665](astral-sh/uv#17665))

##### Preview features

- Better detection for conflicting packages ([#&#8203;17623](astral-sh/uv#17623))
- Upgrade based on outdated build versions in `uv python upgrade` ([#&#8203;17653](astral-sh/uv#17653))

##### Bug fixes

- Change chocolatey system test to ensure uv uses the right python ([#&#8203;17533](astral-sh/uv#17533))
- Fix infinite loop when `SSL_CERT_FILE` is a directory ([#&#8203;17503](astral-sh/uv#17503))

##### Documentation

- Add cargo-xwin to the CONTRIBUTING guide ([#&#8203;17507](astral-sh/uv#17507))
- Fix typo in the documentation of UV\_PUBLISH\_INDEX ([#&#8203;17672](astral-sh/uv#17672))
- Move MSRV to platform support section ([#&#8203;17534](astral-sh/uv#17534))
- Update the testing instructions in the CONTRIBUTING guide ([#&#8203;17528](astral-sh/uv#17528))
- Use `--locked` to install `cargo-xwin` in guide ([#&#8203;17530](astral-sh/uv#17530))
- Warn about PyPy being unmaintained ([#&#8203;17643](astral-sh/uv#17643))
- docs: Correct gitlab-ci.yml to .gitlab-ci.yml ([#&#8203;17682](astral-sh/uv#17682))

##### Other changes

- Update MSRV to 1.91 ([#&#8203;17677](astral-sh/uv#17677))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi45Mi40IiwidXBkYXRlZEluVmVyIjoiNDIuOTIuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6OnBhdGNoIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working test:system Enable system tests for a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI failures on test-system / python3.9 via chocolatey due to Windows version change

3 participants