Skip to content

ci: run pytest via uv run to fix venv PATH breakage from #9214 - #9286

Merged
lstein merged 1 commit into
mainfrom
fix/python-tests-uv-run
Jun 11, 2026
Merged

lstein merged 1 commit into
mainfrom
fix/python-tests-uv-run

Conversation

@lstein

@lstein lstein commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

PR #9214 switched the python-tests workflow's install step from uv pip install --editable ".[test]" to uv sync --no-progress --locked --extra test. This broke every pytest matrix job with:

pytest: command not found
##[error]Process completed with exit code 127.

(Visible on PR #9246's CI; only one job shows the error — the rest report "canceled" because the matrix's default fail-fast kills them once the first fails.)

Root cause

The old uv pip install honored UV_SYSTEM_PYTHON: 1 and installed into the runner's system Python, putting pytest on the PATH. uv sync is a project command — it always installs into a project-local .venv and ignores UV_SYSTEM_PYTHON — so the bare pytest invocation in the next step never sees the synced environment.

Fix

  • Run pytest via uv run --no-sync pytest. The --no-sync flag matters: a plain uv run pytest would first re-sync the environment without --extra test, uninstalling pytest right before trying to run it.
  • Drop UV_SYSTEM_PYTHON: 1 — dead config now that nothing in the job uses the uv pip interface.
  • Drop the actions/setup-python step — setup-uv is already given the matrix python-version, and uv sync provisions its own interpreter.

Related Issues / Discussions

QA Instructions

Note that this PR's own pull_request CI run skips the pytest steps (no python files changed, and the changed-files filter only matches pyproject.toml/invokeai/**/tests/**), so a green check there is vacuous. To exercise the fix for real, a workflow_dispatch run with always_run=true was triggered on this branch: https://github.com/invoke-ai/InvokeAI/actions/runs/27374428547 — all six matrix jobs should reach pytest and pass.

Merge Plan

Straight merge. Unblocks CI for all open PRs touching python files.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable) — n/a, CI config only
  • ❗Changes to a redux slice have a corresponding migration — n/a
  • Documentation added / updated (if applicable) — n/a

🤖 Generated with Claude Code

PR #9214 switched dependency installation from 'uv pip install' (which
honored UV_SYSTEM_PYTHON=1 and installed into the system Python) to
'uv sync', which always installs into a project-local .venv. The bare
'pytest' invocation in the next step never saw that venv, failing with
'pytest: command not found' (exit 127) on every matrix job.

- Run pytest via 'uv run --no-sync pytest'. The --no-sync flag is
  required: a plain 'uv run' would re-sync without '--extra test' and
  uninstall pytest before running it.
- Drop UV_SYSTEM_PYTHON=1, which is dead config now that nothing uses
  the 'uv pip' interface.
- Drop the actions/setup-python step; setup-uv is already given the
  matrix python-version and uv sync provisions its own interpreter.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lstein
lstein requested a review from blessedcoolant as a code owner June 11, 2026 20:11
@github-actions github-actions Bot added the CI-CD Continuous integration / Continuous delivery label Jun 11, 2026
@lstein
lstein merged commit ec0b1e7 into main Jun 11, 2026
17 of 23 checks passed
@lstein
lstein deleted the fix/python-tests-uv-run branch June 11, 2026 20:12
dunkeroni pushed a commit to dunkeroni/InvokeAI that referenced this pull request Jun 29, 2026
PR invoke-ai#9214 switched dependency installation from 'uv pip install' (which
honored UV_SYSTEM_PYTHON=1 and installed into the system Python) to
'uv sync', which always installs into a project-local .venv. The bare
'pytest' invocation in the next step never saw that venv, failing with
'pytest: command not found' (exit 127) on every matrix job.

- Run pytest via 'uv run --no-sync pytest'. The --no-sync flag is
  required: a plain 'uv run' would re-sync without '--extra test' and
  uninstall pytest before running it.
- Drop UV_SYSTEM_PYTHON=1, which is dead config now that nothing uses
  the 'uv pip' interface.
- Drop the actions/setup-python step; setup-uv is already given the
  matrix python-version and uv sync provisions its own interpreter.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI-CD Continuous integration / Continuous delivery

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant