|
| 1 | +use std::path::PathBuf; |
| 2 | + |
1 | 3 | use crate::common::{uv_snapshot, TestContext};
|
2 | 4 | use anyhow::Result;
|
3 | 5 | use assert_fs::fixture::{FileWriteStr, PathChild, PathCreateDir};
|
@@ -263,6 +265,17 @@ fn python_pin_global_use_local_if_available() -> Result<()> {
|
263 | 265 | ----- stderr -----
|
264 | 266 | "###);
|
265 | 267 |
|
| 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 | + |
266 | 279 | // Request Python 3.11 for local .python-version
|
267 | 280 | uv_snapshot!(context.filters(), context.python_pin().arg("3.11"), @r###"
|
268 | 281 | success: true
|
@@ -293,6 +306,22 @@ fn python_pin_global_use_local_if_available() -> Result<()> {
|
293 | 306 | ----- stderr -----
|
294 | 307 | "###);
|
295 | 308 |
|
| 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 | + |
296 | 325 | Ok(())
|
297 | 326 | }
|
298 | 327 |
|
|
0 commit comments