Skip to content

Add test coverage for pip build environments in find_uv_bin#18095

Draft
zanieb wants to merge 8 commits intomainfrom
zb/pip-build-env
Draft

Add test coverage for pip build environments in find_uv_bin#18095
zanieb wants to merge 8 commits intomainfrom
zb/pip-build-env

Conversation

@zanieb
Copy link
Member

@zanieb zanieb commented Feb 18, 2026

To ensure parity with find_ruff_bin (see astral-sh/ruff#13321)

It turns out the _matching_parents prefix lookup already supports this pattern.

@zanieb zanieb changed the title Add support for pip build environments in find_uv_bin Add test coverage for pip build environments in find_uv_bin Feb 18, 2026
@zanieb zanieb added the testing Internal testing of behavior label Feb 18, 2026
@zanieb zanieb force-pushed the zb/pip-build-env branch 5 times, most recently from 60acc44 to 2d44deb Compare February 19, 2026 20:41
Comment on lines 73 to +90
@@ -87,6 +87,6 @@ Write-Output `
"TEMP=$($Tmp)" `
"RUSTUP_HOME=$($Drive)/.rustup" `
"CARGO_HOME=$($Drive)/.cargo" `
"UV_WORKSPACE=$($Drive)/uv" `
"UV_WORKSPACE=$($Drive)/uv/repo" `
Copy link
Member Author

Choose a reason for hiding this comment

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

These were colliding in some filters because the prefix matches

.assert()
.success()
.get_output()
.clone();
Copy link
Member Author

Choose a reason for hiding this comment

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

This clone seems superfluous?

Comment on lines +481 to +484
let found_uv_lines: String = String::from_utf8(output.stdout)
.unwrap()
.lines()
.chain(String::from_utf8(output.stderr).unwrap().lines())
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we need to search both stdout and stderr, where do we expect it?

.collect::<Vec<_>>()
.join("\n");

let snapshot = uv_test::apply_filters(found_uv_lines, &context.filters());
Copy link
Member Author

Choose a reason for hiding this comment

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

Why not insta settings with_filters like we use elsewhere?


// Extract the FOUND_UV= lines from the combined output and apply filters
// so paths are platform-independent.
let found_uv_lines: String = String::from_utf8(output.stdout)
Copy link
Member Author

Choose a reason for hiding this comment

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

If we don't find it we should fail with the stdout / stderr for debugging

Setuptools 69.0.2 on Windows emits `wheel/./project` instead of
`wheel/project` in bdist install paths. Add a test filter to normalize
redundant `/./` path components so the snapshot matches on all platforms.
The raw setuptools output on Windows uses backslashes (`wheel\.\.\project`),
so the filter needs `[\\/]\.[\\/]` to match both slash directions, not
just forward slashes.
Move the CI dev drive layout from `D:\uv` + `D:\uv-tmp` to
`D:\uv\repo` + `D:\uv\tmp` so the workspace path is never a prefix
of the temp dir. This removes the need for the fragile `insert_pos`
logic in `with_filtered_system_tmp` that searched for `[TEMP_DIR]/`
by replacement string value to maintain filter ordering.
…oc comment

Move the many pip-specific filters (temp dirs, progress bars, hashes,
sizes, platform tags, etc.) into a reusable `with_filtered_pip_output`
method on `TestContext`. Also trim the `with_filtered_system_tmp` doc
comment to remove unnecessary implementation details.
Instead of snapshotting the entire verbose pip install output (which is
noisy and fragile across platforms), extract just the FOUND_UV= lines
and snapshot those. This removes the need for with_filtered_pip_output
and all the pip-specific filters.
… assert on missing output

- Remove superfluous .clone() by binding the assert result
- Only search stderr for FOUND_UV= (that's where setup.py prints it)
- Use insta::with_settings! with filters instead of manual apply_filters
- Assert FOUND_UV= lines are non-empty with full stderr for debugging
- Replace `.map(|line| line.trim())` with `.map(str::trim)`
- Use `apply_filters` instead of `insta::with_settings` to avoid
  `String`-to-`&str` tuple coercion issues with unstable `str_as_str`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Internal testing of behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant