mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-01-05 14:07:27 -08:00
242 lines
7.9 KiB
Diff
242 lines
7.9 KiB
Diff
From 5c69e6e3ed1df9b7a2c85b981129a59bf9aec357 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
|
|
Date: Sat, 12 Apr 2025 13:20:44 +0200
|
|
Subject: [PATCH] Collapse whitespace in python_list tests
|
|
|
|
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
|
|
---
|
|
crates/uv/tests/it/common/mod.rs | 7 ++++
|
|
crates/uv/tests/it/python_list.rs | 64 ++++++++++++++++---------------
|
|
2 files changed, 41 insertions(+), 30 deletions(-)
|
|
|
|
diff --git a/crates/uv/tests/it/common/mod.rs b/crates/uv/tests/it/common/mod.rs
|
|
index 0c6d491f2..09bbbb2b1 100644
|
|
--- a/crates/uv/tests/it/common/mod.rs
|
|
+++ b/crates/uv/tests/it/common/mod.rs
|
|
@@ -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 {
|
|
diff --git a/crates/uv/tests/it/python_list.rs b/crates/uv/tests/it/python_list.rs
|
|
index 347993934..657667861 100644
|
|
--- a/crates/uv/tests/it/python_list.rs
|
|
+++ b/crates/uv/tests/it/python_list.rs
|
|
@@ -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
|
|
@@ -22,8 +23,8 @@ fn python_list() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
- cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
+ cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
+ cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -33,7 +34,7 @@ fn python_list() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
+ cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -43,7 +44,7 @@ fn python_list() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
+ cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -53,8 +54,8 @@ fn python_list() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
- cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
+ cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
+ cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -64,7 +65,7 @@ fn python_list() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
+ cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -74,7 +75,7 @@ fn python_list() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
+ cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -87,7 +88,7 @@ fn python_list() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
+ cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -108,8 +109,8 @@ fn python_list() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
- cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
+ cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
+ cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -119,7 +120,7 @@ fn python_list() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
+ cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -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###"
|
|
@@ -146,8 +148,8 @@ fn python_list_pin() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
- cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
+ cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
+ cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -157,8 +159,8 @@ fn python_list_pin() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
- cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
+ cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
+ cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -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###"
|
|
@@ -187,8 +190,8 @@ fn python_list_venv() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
- cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
+ cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
+ cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -198,8 +201,8 @@ fn python_list_venv() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
- cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
+ cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
+ cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -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(
|
|
@@ -298,8 +302,8 @@ fn python_list_duplicate_path_entries() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
- cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
+ cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
+ cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -320,8 +324,8 @@ fn python_list_duplicate_path_entries() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
- cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
+ cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]
|
|
+ cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]
|
|
|
|
----- stderr -----
|
|
");
|
|
@@ -341,8 +345,8 @@ fn python_list_duplicate_path_entries() {
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
- cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]-link/python3
|
|
- cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]-link/python3
|
|
+ cpython-3.12.[X]-[PLATFORM] [PYTHON-3.12]-link/python3
|
|
+ cpython-3.11.[X]-[PLATFORM] [PYTHON-3.11]-link/python3
|
|
|
|
----- stderr -----
|
|
");
|