mirror of https://github.com/astral-sh/uv
Collapse whitespace in python_list tests (#12851)
## Summary Collapse whitespace into a single space in python_list tests, in order to make them agnostic of padding, and therefore pass both with Python 3.12.9 and Python 3.12.10. Fixes #12799 ## Test Plan cargo test --features python --profile=fast-build --no-default-features
This commit is contained in:
parent
99ec6ae144
commit
2d340de2f8
|
|
@ -319,6 +319,13 @@ impl TestContext {
|
|||
self
|
||||
}
|
||||
|
||||
/// Add a filter that collapses duplicate whitespace.
|
||||
#[must_use]
|
||||
pub fn with_collapsed_whitespace(mut self) -> Self {
|
||||
self.filters.push((r"[ \t]+".to_string(), " ".to_string()));
|
||||
self
|
||||
}
|
||||
|
||||
/// Add extra directories and configuration for managed Python installations.
|
||||
#[must_use]
|
||||
pub fn with_managed_python_dirs(mut self) -> Self {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ use crate::common::{uv_snapshot, TestContext};
|
|||
fn python_list() {
|
||||
let mut context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
.with_filtered_python_symlinks()
|
||||
.with_filtered_python_keys();
|
||||
.with_filtered_python_keys()
|
||||
.with_collapsed_whitespace();
|
||||
|
||||
uv_snapshot!(context.filters(), context.python_list().env(EnvVars::UV_TEST_PYTHON_PATH, ""), @r"
|
||||
success: true
|
||||
|
|
@ -129,7 +130,8 @@ fn python_list() {
|
|||
fn python_list_pin() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
.with_filtered_python_symlinks()
|
||||
.with_filtered_python_keys();
|
||||
.with_filtered_python_keys()
|
||||
.with_collapsed_whitespace();
|
||||
|
||||
// Pin to a version
|
||||
uv_snapshot!(context.filters(), context.python_pin().arg("3.12"), @r###"
|
||||
|
|
@ -171,7 +173,8 @@ fn python_list_venv() {
|
|||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin();
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_collapsed_whitespace();
|
||||
|
||||
// Create a virtual environment
|
||||
uv_snapshot!(context.filters(), context.venv().arg("--python").arg("3.12").arg("-q"), @r###"
|
||||
|
|
@ -285,7 +288,8 @@ fn python_list_unsupported_version() {
|
|||
fn python_list_duplicate_path_entries() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
.with_filtered_python_symlinks()
|
||||
.with_filtered_python_keys();
|
||||
.with_filtered_python_keys()
|
||||
.with_collapsed_whitespace();
|
||||
|
||||
// Construct a `PATH` with all entries duplicated
|
||||
let path = std::env::join_paths(
|
||||
|
|
|
|||
Loading…
Reference in New Issue