summaryrefslogtreecommitdiff
path: root/dev-python/uv/files/uv-0.6.13-test-ws.patch
blob: bda1b6d0c93a56b361ee9c54f0a6ae251c5ce92e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
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 -----
         ");