Skip to content

Commit

Permalink
uv/tests: update existing test
Browse files Browse the repository at this point in the history
This is the test we tweaked a few commits back when we first removed the
error checking in the resolver. We now add in some `uv sync` commands,
including one that should fail.
  • Loading branch information
BurntSushi committed Jan 22, 2025
1 parent a8d23da commit 4051cff
Showing 1 changed file with 37 additions and 14 deletions.
51 changes: 37 additions & 14 deletions crates/uv/tests/it/lock_conflict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1016,10 +1016,6 @@ fn extra_unconditional() -> Result<()> {
[tool.uv.sources]
proxy1 = { workspace = true }
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
"#,
)?;

Expand Down Expand Up @@ -1054,8 +1050,16 @@ fn extra_unconditional() -> Result<()> {
----- stderr -----
Resolved 6 packages in [TIME]
"###);
// This should error since we're enabling two conflicting extras.
uv_snapshot!(context.filters(), context.sync().arg("--frozen"), @r###"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
error: Found conflicting extras `proxy1[extra1]` and `proxy1[extra2]` enabled simultaneously
"###);

// An error should occur even when only one conflicting extra is enabled.
root_pyproject_toml.write_str(
r#"
[project]
Expand All @@ -1071,10 +1075,6 @@ fn extra_unconditional() -> Result<()> {
[tool.uv.sources]
proxy1 = { workspace = true }
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
"#,
)?;
uv_snapshot!(context.filters(), context.lock(), @r###"
Expand All @@ -1085,6 +1085,20 @@ fn extra_unconditional() -> Result<()> {
----- stderr -----
Resolved 6 packages in [TIME]
"###);
// This is fine because we are only enabling one
// extra, and thus, there is no conflict.
uv_snapshot!(context.filters(), context.sync().arg("--frozen"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Prepared 3 packages in [TIME]
Installed 3 packages in [TIME]
+ anyio==4.1.0
+ idna==3.6
+ sniffio==1.3.1
"###);

// And same thing for the other extra.
root_pyproject_toml.write_str(
Expand All @@ -1102,11 +1116,6 @@ fn extra_unconditional() -> Result<()> {
[tool.uv.sources]
proxy1 = { workspace = true }
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
"#,
)?;
uv_snapshot!(context.filters(), context.lock(), @r###"
Expand All @@ -1117,6 +1126,20 @@ fn extra_unconditional() -> Result<()> {
----- stderr -----
Resolved 6 packages in [TIME]
"###);
// This is fine because we are only enabling one
// extra, and thus, there is no conflict.
uv_snapshot!(context.filters(), context.sync().arg("--frozen"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Prepared 1 package in [TIME]
Uninstalled 1 package in [TIME]
Installed 1 package in [TIME]
- anyio==4.1.0
+ anyio==4.2.0
"###);

Ok(())
}
Expand Down

0 comments on commit 4051cff

Please sign in to comment.