Skip to content

Commit 93cf33d

Browse files
committed
Add test
1 parent 258c99f commit 93cf33d

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

crates/uv/tests/tool_install.rs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,69 @@ fn tool_install_no_entrypoints() {
13851385
Installed 1 package in [TIME]
13861386
+ iniconfig==2.0.0
13871387
"###);
1388+
1389+
// Ensure the tool environment is not created.
1390+
tool_dir
1391+
.child("iniconfig")
1392+
.assert(predicate::path::missing());
1393+
bin_dir
1394+
.child("iniconfig")
1395+
.assert(predicate::path::missing());
1396+
}
1397+
1398+
/// Test installing a package that can't be installed.
1399+
#[test]
1400+
fn tool_install_uninstallable() {
1401+
let context = TestContext::new("3.12").with_filtered_exe_suffix();
1402+
let tool_dir = context.temp_dir.child("tools");
1403+
let bin_dir = context.temp_dir.child("bin");
1404+
1405+
let filters = context
1406+
.filters()
1407+
.into_iter()
1408+
.chain([
1409+
(r"exit code: 1", "exit status: 1"),
1410+
(r"bdist\.[^/\\\s]+-[^/\\\s]+", "bdist.linux-x86_64"),
1411+
(r"\\\.", ""),
1412+
(r"#+", "#"),
1413+
])
1414+
.collect::<Vec<_>>();
1415+
uv_snapshot!(filters, context.tool_install()
1416+
.arg("pyenv")
1417+
.arg("--quiet")
1418+
.env("UV_TOOL_DIR", tool_dir.as_os_str())
1419+
.env("XDG_BIN_HOME", bin_dir.as_os_str())
1420+
.env("PATH", bin_dir.as_os_str()), @r##"
1421+
success: false
1422+
exit_code: 2
1423+
----- stdout -----
1424+
1425+
----- stderr -----
1426+
error: Failed to prepare distributions
1427+
Caused by: Failed to fetch wheel: pyenv==0.0.1
1428+
Caused by: Build backend failed to build wheel through `build_wheel` (exit status: 1)
1429+
1430+
[stdout]
1431+
running bdist_wheel
1432+
running build
1433+
installing to build/bdist.linux-x86_64/wheel
1434+
running install
1435+
1436+
[stderr]
1437+
# NOTE #
1438+
We are sorry, but this package is not installable with pip.
1439+
1440+
Please read the installation instructions at:
1441+
1442+
https://github.com/pyenv/pyenv#installation
1443+
#
1444+
1445+
1446+
"##);
1447+
1448+
// Ensure the tool environment is not created.
1449+
tool_dir.child("pyenv").assert(predicate::path::missing());
1450+
bin_dir.child("pyenv").assert(predicate::path::missing());
13881451
}
13891452

13901453
/// Test installing a tool with a bare URL requirement.

0 commit comments

Comments
 (0)