Skip to content

Commit

Permalink
Simplify test
Browse files Browse the repository at this point in the history
  • Loading branch information
j178 committed Jul 23, 2024
1 parent c270156 commit 302db93
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions crates/uv/tests/python_pin.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![cfg(all(feature = "python", feature = "pypi"))]

use anyhow::Result;
use assert_fs::fixture::{FileWriteStr, PathChild, PathCreateDir};
use assert_fs::fixture::{FileWriteStr, PathChild};
use common::{uv_snapshot, TestContext};
use insta::assert_snapshot;
use uv_python::{
Expand Down Expand Up @@ -635,26 +635,28 @@ fn python_pin_resolve() {
fn python_pin_with_comments() -> Result<()> {
let context = TestContext::new_with_versions(&[]);

let child = context.temp_dir.child("foo");
child.create_dir_all()?;
let content = indoc::indoc! {r"
3.12
# 3.11
3.10
"};

let version_file = child.child(PYTHON_VERSION_FILENAME);
version_file.write_str("3.12\n\n# 3.11\n3.10\n\n")?;
uv_snapshot!(context.filters(), context.python_pin().current_dir(&child), @r###"
let version_file = context.temp_dir.child(PYTHON_VERSION_FILENAME);
version_file.write_str(content)?;
uv_snapshot!(context.filters(), context.python_pin(), @r###"
success: true
exit_code: 0
----- stdout -----
3.12
----- stderr -----
"###);
fs_err::remove_file(version_file)?;

let child = context.temp_dir.child("bar");
child.create_dir_all()?;

let versions_file = child.child(PYTHON_VERSIONS_FILENAME);
versions_file.write_str("3.12\n\n# 3.11\n3.10\n\n")?;
uv_snapshot!(context.filters(), context.python_pin().current_dir(&child), @r###"
let versions_file = context.temp_dir.child(PYTHON_VERSIONS_FILENAME);
versions_file.write_str(content)?;
uv_snapshot!(context.filters(), context.python_pin(), @r###"
success: true
exit_code: 0
----- stdout -----
Expand Down

0 comments on commit 302db93

Please sign in to comment.