From 4051cff582f043d5a9cdd9769ab45b1d1f35221d Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Wed, 22 Jan 2025 15:00:11 -0500 Subject: [PATCH] uv/tests: update existing test 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. --- crates/uv/tests/it/lock_conflict.rs | 51 +++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/crates/uv/tests/it/lock_conflict.rs b/crates/uv/tests/it/lock_conflict.rs index 5081a837dcd4..a0143635f2cd 100644 --- a/crates/uv/tests/it/lock_conflict.rs +++ b/crates/uv/tests/it/lock_conflict.rs @@ -1016,10 +1016,6 @@ fn extra_unconditional() -> Result<()> { [tool.uv.sources] proxy1 = { workspace = true } - - [build-system] - requires = ["hatchling"] - build-backend = "hatchling.build" "#, )?; @@ -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] @@ -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###" @@ -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( @@ -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###" @@ -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(()) }