Skip to content

Commit fd6cfc5

Browse files
committed
Remove filter for venv in working directory
1 parent 10b13f0 commit fd6cfc5

File tree

5 files changed

+35
-41
lines changed

5 files changed

+35
-41
lines changed

crates/uv/tests/common/mod.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ impl TestContext {
9191
pub fn new_with_versions(python_versions: &[&str]) -> Self {
9292
let temp_dir = assert_fs::TempDir::new().expect("Failed to create temp dir");
9393
let cache_dir = assert_fs::TempDir::new().expect("Failed to create cache dir");
94+
let canonical_temp_dir = temp_dir.canonicalize().unwrap();
95+
let venv = ChildPath::new(canonical_temp_dir.join(".venv"));
9496

95-
let venv = temp_dir.child(".venv");
9697
let python_version = python_versions
9798
.first()
9899
.map(|version| PythonVersion::from_str(version).unwrap());
@@ -177,19 +178,12 @@ impl TestContext {
177178
filters.push((
178179
Self::path_pattern(
179180
site_packages
180-
.strip_prefix(&temp_dir)
181+
.strip_prefix(&canonical_temp_dir)
181182
.expect("The test site-packages directory is always in the tempdir"),
182183
),
183184
"[SITE_PACKAGES]/".to_string(),
184185
));
185186
};
186-
filters.push((
187-
Self::path_pattern(
188-
venv.strip_prefix(&temp_dir)
189-
.expect("The test virtual environment directory is always in the tempdir"),
190-
),
191-
"[VENV]/".to_string(),
192-
));
193187

194188
// Filter non-deterministic temporary directory names
195189
// Note we apply this _after_ all the full paths to avoid breaking their matching

crates/uv/tests/lock.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1894,7 +1894,7 @@ fn lock_requires_python() -> Result<()> {
18941894
18951895
----- stderr -----
18961896
warning: `uv sync` is experimental and may change without warning.
1897-
Removing virtual environment at: [VENV]/
1897+
Removing virtual environment at: .venv
18981898
error: No interpreter found for Python >=3.12 in provided path, active virtual environment, or search path
18991899
"###);
19001900

crates/uv/tests/run.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn run_with_python_version() -> Result<()> {
5252
5353
----- stderr -----
5454
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
55-
Creating virtualenv at: [VENV]/
55+
Creating virtualenv at: .venv
5656
Resolved 5 packages in [TIME]
5757
Downloaded 4 packages in [TIME]
5858
Installed 4 packages in [TIME]
@@ -102,9 +102,9 @@ fn run_with_python_version() -> Result<()> {
102102
3.6.0
103103
104104
----- stderr -----
105-
Removing virtual environment at: [VENV]/
105+
Removing virtual environment at: .venv
106106
Using Python 3.11.[X] interpreter at: [PYTHON-3.11]
107-
Creating virtualenv at: [VENV]/
107+
Creating virtualenv at: .venv
108108
Resolved 5 packages in [TIME]
109109
Downloaded 4 packages in [TIME]
110110
Installed 4 packages in [TIME]

crates/uv/tests/venv.rs

+26-26
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ fn create_venv() {
2323
2424
----- stderr -----
2525
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
26-
Creating virtualenv at: [VENV]/
27-
Activate with: source [VENV]/bin/activate
26+
Creating virtualenv at: .venv
27+
Activate with: source .venv/bin/activate
2828
"###
2929
);
3030

@@ -41,8 +41,8 @@ fn create_venv() {
4141
4242
----- stderr -----
4343
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
44-
Creating virtualenv at: [VENV]/
45-
Activate with: source [VENV]/bin/activate
44+
Creating virtualenv at: .venv
45+
Activate with: source .venv/bin/activate
4646
"###
4747
);
4848

@@ -61,8 +61,8 @@ fn create_venv_defaults_to_cwd() {
6161
6262
----- stderr -----
6363
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
64-
Creating virtualenv at: [VENV]/
65-
Activate with: source [VENV]/bin/activate
64+
Creating virtualenv at: .venv
65+
Activate with: source .venv/bin/activate
6666
"###
6767
);
6868

@@ -82,8 +82,8 @@ fn create_venv_ignores_virtual_env_variable() {
8282
8383
----- stderr -----
8484
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
85-
Creating virtualenv at: [VENV]/
86-
Activate with: source [VENV]/bin/activate
85+
Creating virtualenv at: .venv
86+
Activate with: source .venv/bin/activate
8787
"###
8888
);
8989
}
@@ -102,9 +102,9 @@ fn seed() {
102102
103103
----- stderr -----
104104
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
105-
Creating virtualenv at: [VENV]/
105+
Creating virtualenv at: .venv
106106
+ pip==24.0
107-
Activate with: source [VENV]/bin/activate
107+
Activate with: source .venv/bin/activate
108108
"###
109109
);
110110

@@ -125,11 +125,11 @@ fn seed_older_python_version() {
125125
126126
----- stderr -----
127127
Using Python 3.10.[X] interpreter at: [PYTHON-3.10]
128-
Creating virtualenv at: [VENV]/
128+
Creating virtualenv at: .venv
129129
+ pip==24.0
130130
+ setuptools==69.2.0
131131
+ wheel==0.43.0
132-
Activate with: source [VENV]/bin/activate
132+
Activate with: source .venv/bin/activate
133133
"###
134134
);
135135

@@ -252,11 +252,11 @@ fn file_exists() -> Result<()> {
252252
253253
----- stderr -----
254254
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
255-
Creating virtualenv at: [VENV]/
255+
Creating virtualenv at: .venv
256256
uv::venv::creation
257257
258258
× Failed to create virtualenv
259-
╰─▶ File exists at `[VENV]/`
259+
╰─▶ File exists at `.venv`
260260
"###
261261
);
262262

@@ -279,8 +279,8 @@ fn empty_dir_exists() -> Result<()> {
279279
280280
----- stderr -----
281281
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
282-
Creating virtualenv at: [VENV]/
283-
Activate with: source [VENV]/bin/activate
282+
Creating virtualenv at: .venv
283+
Activate with: source .venv/bin/activate
284284
"###
285285
);
286286

@@ -307,11 +307,11 @@ fn non_empty_dir_exists() -> Result<()> {
307307
308308
----- stderr -----
309309
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
310-
Creating virtualenv at: [VENV]/
310+
Creating virtualenv at: .venv
311311
uv::venv::creation
312312
313313
× Failed to create virtualenv
314-
╰─▶ The directory `[VENV]/` exists, but it's not a virtualenv
314+
╰─▶ The directory `.venv` exists, but it's not a virtualenv
315315
"###
316316
);
317317

@@ -337,11 +337,11 @@ fn non_empty_dir_exists_allow_existing() -> Result<()> {
337337
338338
----- stderr -----
339339
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
340-
Creating virtualenv at: [VENV]/
340+
Creating virtualenv at: .venv
341341
uv::venv::creation
342342
343343
× Failed to create virtualenv
344-
╰─▶ The directory `[VENV]/` exists, but it's not a virtualenv
344+
╰─▶ The directory `.venv` exists, but it's not a virtualenv
345345
"###
346346
);
347347

@@ -356,8 +356,8 @@ fn non_empty_dir_exists_allow_existing() -> Result<()> {
356356
357357
----- stderr -----
358358
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
359-
Creating virtualenv at: [VENV]/
360-
Activate with: source [VENV]/bin/activate
359+
Creating virtualenv at: .venv
360+
Activate with: source .venv/bin/activate
361361
"###
362362
);
363363

@@ -374,8 +374,8 @@ fn non_empty_dir_exists_allow_existing() -> Result<()> {
374374
375375
----- stderr -----
376376
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
377-
Creating virtualenv at: [VENV]/
378-
Activate with: source [VENV]/bin/activate
377+
Creating virtualenv at: .venv
378+
Activate with: source .venv/bin/activate
379379
"###
380380
);
381381

@@ -443,8 +443,8 @@ fn virtualenv_compatibility() {
443443
----- stderr -----
444444
warning: virtualenv's `--clear` has no effect (uv always clears the virtual environment).
445445
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
446-
Creating virtualenv at: [VENV]/
447-
Activate with: source [VENV]/bin/activate
446+
Creating virtualenv at: .venv
447+
Activate with: source .venv/bin/activate
448448
"###
449449
);
450450

crates/uv/tests/workspace.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ fn test_uv_run_with_package_virtual_workspace() -> Result<()> {
419419
420420
----- stderr -----
421421
Using Python 3.12.[X] interpreter at: [PYTHON]
422-
Creating virtualenv at: [VENV]/
422+
Creating virtualenv at: .venv
423423
Resolved 8 packages in [TIME]
424424
Downloaded 5 packages in [TIME]
425425
Installed 5 packages in [TIME]
@@ -479,7 +479,7 @@ fn test_uv_run_with_package_root_workspace() -> Result<()> {
479479
480480
----- stderr -----
481481
Using Python 3.12.[X] interpreter at: [PYTHON]
482-
Creating virtualenv at: [VENV]/
482+
Creating virtualenv at: .venv
483483
Resolved 8 packages in [TIME]
484484
Downloaded 5 packages in [TIME]
485485
Installed 5 packages in [TIME]

0 commit comments

Comments
 (0)