From 549d7dfe371f9e86706b2c2a4ed6c408c074a2a6 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 19 Jun 2024 10:39:55 -0400 Subject: [PATCH] Add test case for wheel installation with different path (#4396) Regression test for #4391 / https://github.com/astral-sh/uv/pull/4393 --- crates/uv/tests/pip_install.rs | 57 ++++++++++++++++++++++++ scripts/links/ok-1.0.0-py3-none-any.whl | Bin 0 -> 875 bytes scripts/links/ok-2.0.0-py3-none-any.whl | Bin 0 -> 871 bytes 3 files changed, 57 insertions(+) create mode 100644 scripts/links/ok-1.0.0-py3-none-any.whl create mode 100644 scripts/links/ok-2.0.0-py3-none-any.whl diff --git a/crates/uv/tests/pip_install.rs b/crates/uv/tests/pip_install.rs index 8b4095697..be49a54a1 100644 --- a/crates/uv/tests/pip_install.rs +++ b/crates/uv/tests/pip_install.rs @@ -3178,6 +3178,63 @@ requires-python = ">=3.8" Ok(()) } +/// Install from a direct path (wheel) with changed versions in the path. +#[test] +fn path_version_change() { + let context = TestContext::new("3.12"); + + uv_snapshot!(context.filters(), context.install() + .arg(context.workspace_root.join("scripts/links/ok-1.0.0-py3-none-any.whl")), @r###" + success: true + exit_code: 0 + ----- stdout ----- + + ----- stderr ----- + Resolved 1 package in [TIME] + Prepared 1 package in [TIME] + Installed 1 package in [TIME] + + ok==1.0.0 (from file://[WORKSPACE]/scripts/links/ok-1.0.0-py3-none-any.whl) + "### + ); + + // Installing the same path again should be a no-op + uv_snapshot!(context.filters(), context.install() + .arg(context.workspace_root.join("scripts/links/ok-1.0.0-py3-none-any.whl")), @r###" + success: true + exit_code: 0 + ----- stdout ----- + + ----- stderr ----- + Audited 1 package in [TIME] + "### + ); + + // Installing a new path should succeed + uv_snapshot!(context.filters(), context.install() + .arg(context.workspace_root.join("scripts/links/ok-2.0.0-py3-none-any.whl")), @r###" + success: true + exit_code: 0 + ----- stdout ----- + + ----- stderr ----- + Resolved 1 package in [TIME] + Audited 1 package in [TIME] + "### + ); + + // Installing a new path should succeed regardless of which version is "newer" + uv_snapshot!(context.filters(), context.install() + .arg(context.workspace_root.join("scripts/links/ok-1.0.0-py3-none-any.whl")), @r###" + success: true + exit_code: 0 + ----- stdout ----- + + ----- stderr ----- + Audited 1 package in [TIME] + "### + ); +} + /// Ignore a URL dependency with a non-matching marker. #[test] fn editable_url_with_marker() -> Result<()> { diff --git a/scripts/links/ok-1.0.0-py3-none-any.whl b/scripts/links/ok-1.0.0-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..2cc29bf768e93df96d300f79e1280543874edd76 GIT binary patch literal 875 zcmWIWW@Zs#U|`??VyA%Rmp-~n09j%{%m>8z+4}MEnR%Hd@$q^EmEHaN-nv@n&YbV= z58n_PV06X!f^onjCWZhMGeWOikgx^nbp>K+uo=3BdImt4l384$o0*rEukY&`;^^WS z;`rHD*VD&S$MXs=#N5q62A7PVeeyozyEW*<`DabtQm-UmNEWaz6`PhOwp8pjTgbGO zhL*QEy3xtB(b|C$ko|D$R+p8?y@EW28IiF z^F0k3m2=tHSA7iR;Bea@+&)XW&D}|m@o&}c9hL9uN-ceZSEfu~=2pyp-8=2vo1f-7 z4|q?mTd19PI_!$4?(q-r+fxs%|1dGZPA*G#FYj%p%X3}`B{BaM{&dT6<+-X;8s*dY z%HtlNd$sz$#ffmcwN4jvuFsU5+@RUZex*8j&c{bKbCk;4B{rPgZFn=_)!tp~smoWW z=5?!22#obghD`t&P*U40C^!1MgRZ+ literal 0 HcmV?d00001 diff --git a/scripts/links/ok-2.0.0-py3-none-any.whl b/scripts/links/ok-2.0.0-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..f05a8880a89c4517f59d85af4cf0b36f687ca7e4 GIT binary patch literal 871 zcmWIWW@Zs#U|`??Vy6JB6Ov^TK$aK~^8s;wwtjqkW?p7Ve7s&kWp}^6x31Q?Gv~Ye z!#9Km7+o^HU>xv>i6H>R49opD_SyjTx&pB@*bH4GJp&+2$t*6>&CE;7*Y|Y|addGE zas2G7>*?dE<9US_V(#W3gGRwe zGr8IoUu>Fm>Wa)oIqPFfICKrOSDn6o-)w8vxqmCF4$R1TGIwL$Z}z<9hc?VLES_9^ z>icY~EvuRqXCArD(5crx>w)c_uA8Ze@oBg2d-CusUY?cl<)ZZT?bcJy2J$9NN|t~A z!#L~vjFc%;PiJ*py8HFO^~Q7C#kf`m+ax}SW^asJnR!%|sqcIC9X*cDeX^b2w<;6c z&s-09`7`(ifBsazL&w%g-?Iu_w&}Cmfmd7Dl)s0&pEOx$$FR3Pz?+dtgc)}N0(u_| zmNbGW)Z~P&7d_!XbTTk3VRQlO#fVW@GD0^9Jux5*+KJsDaMD0G1w9%Ornmwl7E1zy VL~4LHD;r2D3lItc71}d_cmVKl6ZilC literal 0 HcmV?d00001