← Back to issue list

fix(tests): handle uv init's new src/ scaffolding in uv plugin integration test

View original Github issue

Metadata

Project
charmcraft
Number
#2820
Type
pull request
State
merged
Author
lengau
Labels
—
Created
Updated
Closed

Current evaluation

PR #2820 merged (by lengau, Copilot CLI-authored): the uv_project fixture in tests/integration/parts/plugins/test_uv.py now deletes uv init's scaffolded src/ before recreating it, fixing the FileExistsError CI failure from PR #2818.

Resolution: closed resolved

Reason: The PR was merged into main with 2 approvals; it removes the uv-init-scaffolded src/ directory in the uv_project fixture so the unconditional source_dir.mkdir() no longer raises FileExistsError, unblocking the failing integration run linked from #2818.

Evaluated by: mr-cal-bot

No scores available.

Issue body

> [!NOTE] > This PR was created by [GitHub Copilot CLI](https://github.com/github/copilot-cli) (an AI agent), on behalf of @lengau. ## Summary Fixes the integration test failures seen in [run 31630147223](https://github.com/canonical/charmcraft/actions/runs/31630147223/job/94226573094?pr=2818): ``` FileExistsError: [Errno 17] File exists: '.../project/src' ``` Newer versions of the `uv` CLI now scaffold a `src/<package>/__init__.py` layout by default during `uv init --no-workspace`, so the `uv_project` pytest fixture's unconditional `source_dir.mkdir()` call raised because the directory already existed. ## Fix The fixture now removes any `uv init`-scaffolded `src/` directory before recreating it, so the source tree only ever contains what the test intends (just `charm.py`), rather than silently leaving an unrelated scaffolded package (`src/test_charm/__init__.py`) that would otherwise get built, installed, and staged alongside it. ## Review Had 5 different models (Claude Opus 4.5, GPT-5.4, Gemini 3.1 Pro, Grok 4.5, Kimi K3) independently review the change. Gemini 3.1 Pro flagged that a simpler `exist_ok=True` fix would leave the scaffolded package in place; addressed by removing the directory first instead. ## Testing - `ruff check tests/integration/parts/plugins/test_uv.py` passes. - Ran the test locally — fixture setup succeeds with no `FileExistsError` (only remaining local failure is an unrelated sandbox limitation: no privileged apt backend available here, not present on CI runners).

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved PR #2820 merged (by lengau, Copilot CLI-authored): the uv_project fixture in tests/integration/parts/plugins/test_uv.py now deletes uv init's scaffolded src/ before recreating it, fixing the FileExistsError CI failure from PR #2818.
stealth/space-bunny-alpha — closed resolved Merged in canonical/charmcraft#2820: the uv plugin integration fixture now removes uv init's scaffolded src/ before recreating it, fixing FileExistsError and preventing unintended package staging.
qwen/qwen3.6-35b-a3b — — Merged fix for test failures caused by uv init scaffolding a src/ directory by default. The fixture removes the existing src/ directory before recreation, preventing FileExistsError and ensuring only intended files are staged.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 10
Confidence: 95
needs review Updates uv plugin integration test fixture to handle uv CLI's new default src/ scaffolding. Removes pre-existing src/ directory to prevent FileExistsError and avoid building unintended packages. Approved by 2 reviewers with passing CI.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 10
Confidence: 90
needs review Fixes integration test failure caused by uv CLI defaulting to src/ scaffolding. Removes existing src/ directory in pytest fixture before recreation. Currently approved, mostly passing CI, minor unrelated failures.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 15
Confidence: 90
needs review Updates the uv plugin integration test fixture to handle uv's new src/ scaffolding by removing existing directories before recreation. CI passes, awaiting maintainer review.

Update history

Date Change
updated
updated
updated
created

Related work

  • Related To: canonical/charmcraft#2818 (confidence 88%)

    The PR fixes integration test failures (run 31630147223) introduced/observed while testing #2818's snap packaging change

Related issues

Issue Project State Summary Similarity
#956 fix: make uv plugin re-entrant on code changes craft-parts merged Merged PR #956 as commit a35ccbfe, making the uv plugin re-entrant so source-code changes are detected without manually cleaning the parts build space.
71%