Skip to content

Commit 87aeecc

Browse files
committed
..
1 parent bb83597 commit 87aeecc

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

crates/uv/tests/it/python_pin.rs

+29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::path::PathBuf;
2+
13
use crate::common::{uv_snapshot, TestContext};
24
use anyhow::Result;
35
use assert_fs::fixture::{FileWriteStr, PathChild, PathCreateDir};
@@ -263,6 +265,17 @@ fn python_pin_global_use_local_if_available() -> Result<()> {
263265
----- stderr -----
264266
"###);
265267

268+
let mut global_version_path = PathBuf::from(uv.path());
269+
global_version_path.push(PYTHON_VERSION_FILENAME);
270+
let global_python_version = context.read(&global_version_path);
271+
insta::with_settings!({
272+
filters => context.filters(),
273+
}, {
274+
assert_snapshot!(global_python_version, @r###"
275+
3.12
276+
"###);
277+
});
278+
266279
// Request Python 3.11 for local .python-version
267280
uv_snapshot!(context.filters(), context.python_pin().arg("3.11"), @r###"
268281
success: true
@@ -293,6 +306,22 @@ fn python_pin_global_use_local_if_available() -> Result<()> {
293306
----- stderr -----
294307
"###);
295308

309+
// Local .python-version exists and has the right version.
310+
let local_python_version = context.read(PYTHON_VERSION_FILENAME);
311+
assert_snapshot!(local_python_version, @r###"
312+
3.11
313+
"###);
314+
315+
// Global .python-version still exists and has the right version.
316+
let global_python_version = context.read(&global_version_path);
317+
insta::with_settings!({
318+
filters => context.filters(),
319+
}, {
320+
assert_snapshot!(global_python_version, @r###"
321+
3.12
322+
"###);
323+
});
324+
296325
Ok(())
297326
}
298327

0 commit comments

Comments
 (0)