Skip to content

Commit e5f061e

Browse files
authored
Add test case for wheel with the same name at a different absolute path (#4398)
As discussed at #4396 (comment) This may not be the desired behavior, but let's track it.
1 parent 1f2dd5b commit e5f061e

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

crates/uv/tests/pip_install.rs

+53
Original file line numberDiff line numberDiff line change
@@ -3243,6 +3243,59 @@ fn path_name_version_change() {
32433243
);
32443244
}
32453245

3246+
/// Install from a direct path (wheel) with the same name at a different path.
3247+
#[test]
3248+
fn path_changes_with_same_name() -> Result<()> {
3249+
let context = TestContext::new("3.12");
3250+
3251+
let wheel = context
3252+
.workspace_root
3253+
.join("scripts/links/ok-1.0.0-py3-none-any.whl");
3254+
3255+
let one = context.temp_dir.child("one");
3256+
one.create_dir_all()?;
3257+
let one_wheel = one.child(wheel.file_name().unwrap());
3258+
3259+
let two = context.temp_dir.child("two");
3260+
two.create_dir_all()?;
3261+
let two_wheel = two.child(wheel.file_name().unwrap());
3262+
3263+
fs_err::copy(&wheel, &one_wheel)?;
3264+
fs_err::copy(&wheel, &two_wheel)?;
3265+
3266+
uv_snapshot!(context.filters(), context.install()
3267+
.arg(one_wheel.as_os_str()), @r###"
3268+
success: true
3269+
exit_code: 0
3270+
----- stdout -----
3271+
3272+
----- stderr -----
3273+
Resolved 1 package in [TIME]
3274+
Prepared 1 package in [TIME]
3275+
Installed 1 package in [TIME]
3276+
+ ok==1.0.0 (from file://[TEMP_DIR]/one/ok-1.0.0-py3-none-any.whl)
3277+
"###
3278+
);
3279+
3280+
uv_snapshot!(context.filters(), context.install()
3281+
.arg(two_wheel.as_os_str()), @r###"
3282+
success: true
3283+
exit_code: 0
3284+
----- stdout -----
3285+
3286+
----- stderr -----
3287+
Resolved 1 package in [TIME]
3288+
Prepared 1 package in [TIME]
3289+
Uninstalled 1 package in [TIME]
3290+
Installed 1 package in [TIME]
3291+
- ok==1.0.0 (from file://[TEMP_DIR]/one/ok-1.0.0-py3-none-any.whl)
3292+
+ ok==1.0.0 (from file://[TEMP_DIR]/two/ok-1.0.0-py3-none-any.whl)
3293+
"###
3294+
);
3295+
3296+
Ok(())
3297+
}
3298+
32463299
/// Ignore a URL dependency with a non-matching marker.
32473300
#[test]
32483301
fn editable_url_with_marker() -> Result<()> {

0 commit comments

Comments
 (0)