Skip to content

Commit

Permalink
Use universal locking test to deal with windows differences
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Dec 5, 2024
1 parent 1765564 commit 1b335a5
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 67 deletions.
44 changes: 44 additions & 0 deletions crates/uv/tests/it/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19009,3 +19009,47 @@ fn lock_recursive_extra() -> Result<()> {

Ok(())
}

/// Don't show an unpinned lower bound warning if the package was provided both by name and by URL,
/// or if the package was part of a constraints files.
///
/// See <https://github.com/astral-sh/uv/issues/8155>, the original example was:
/// ```
/// uv pip install dist/pymatgen-2024.10.3.tar.gz pymatgen[ci,optional] --resolution=lowest
/// ```
#[test]
fn no_lowest_warning_with_name_and_url() -> Result<()> {
let context = TestContext::new("3.12");

let pyproject_toml = context.temp_dir.child("pyproject.toml");
pyproject_toml.write_str(
r#"
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = [
"anyio[trio]",
"anyio @ https://files.pythonhosted.org/packages/e6/e3/c4c8d473d6780ef1853d630d581f70d655b4f8d7553c6997958c283039a2/anyio-4.4.0.tar.gz"
]

[tool.uv]
constraint-dependencies = [
"sortedcontainers==2.4.0",
"outcome==1.3.0.post0",
"pycparser==2.20",
]
"#,
)?;

uv_snapshot!(context.filters(), context.lock(), @r###"
success: true
exit_code: 0
----- stdout -----

----- stderr -----
Resolved 10 packages in [TIME]
"###);

Ok(())
}
67 changes: 0 additions & 67 deletions crates/uv/tests/it/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13862,73 +13862,6 @@ fn compile_lowest_extra_unpinned_warning() -> Result<()> {
Ok(())
}

/// Don't show an unpinned lower bound warning if the package was provided both by name and by URL,
/// or if the package was part of a constraints files.
///
/// See <https://github.com/astral-sh/uv/issues/8155>, the original example was:
/// ```
/// uv pip install dist/pymatgen-2024.10.3.tar.gz pymatgen[ci,optional] --resolution=lowest
/// ```
#[test]
fn no_lowest_warning_with_name_and_url() -> Result<()> {
let context = TestContext::new("3.12");

let requirements_in = context.temp_dir.child("requirements.in");
requirements_in.write_str(indoc::indoc! {r"
anyio[trio]
https://files.pythonhosted.org/packages/e6/e3/c4c8d473d6780ef1853d630d581f70d655b4f8d7553c6997958c283039a2/anyio-4.4.0.tar.gz
"})?;
let constraints = context.temp_dir.child("constraints.txt");
constraints.write_str(indoc::indoc! {r"
sortedcontainers==2.4.0
outcome==1.3.0.post0
pycparser==2.20
"})?;

uv_snapshot!(context.filters(), context.pip_compile()
.arg("--resolution")
.arg("lowest")
.arg("--constraints")
.arg(constraints.path())
.arg(requirements_in.path()), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] --resolution lowest --constraints [TEMP_DIR]/constraints.txt [TEMP_DIR]/requirements.in
anyio @ https://files.pythonhosted.org/packages/e6/e3/c4c8d473d6780ef1853d630d581f70d655b4f8d7553c6997958c283039a2/anyio-4.4.0.tar.gz
# via -r requirements.in
attrs==20.1.0
# via
# outcome
# trio
idna==2.8
# via
# anyio
# trio
outcome==1.3.0.post0
# via
# -c constraints.txt
# trio
sniffio==1.3.0
# via
# anyio
# trio
sortedcontainers==2.4.0
# via
# -c constraints.txt
# trio
trio==0.23.0
# via anyio
----- stderr -----
Resolved 7 packages in [TIME]
"###
);

Ok(())
}

/// Test that we use the version in the source distribution filename for compiling, even if the
/// version is declared as dynamic.
///
Expand Down

0 comments on commit 1b335a5

Please sign in to comment.