mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-29 05:24:46 +00:00
Replace MarkupSafe
for no-binary tests (#1296)
This commit is contained in:
parent
36783743ba
commit
40b74fb0fb
2 changed files with 16 additions and 166 deletions
|
@ -662,119 +662,6 @@ fn install_no_index_version() {
|
||||||
context.assert_command("import flask").failure();
|
context.assert_command("import flask").failure();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Install a package without using pre-built wheels.
|
|
||||||
#[test]
|
|
||||||
fn install_no_binary() {
|
|
||||||
let context = TestContext::new("3.12");
|
|
||||||
|
|
||||||
let mut command = command(&context);
|
|
||||||
command
|
|
||||||
.arg("jinja2")
|
|
||||||
.arg("--no-binary")
|
|
||||||
.arg(":all:")
|
|
||||||
.arg("--strict");
|
|
||||||
if cfg!(all(windows, debug_assertions)) {
|
|
||||||
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
|
|
||||||
// default windows stack of 1MB
|
|
||||||
command.env("PUFFIN_STACK_SIZE", (2 * 1024 * 1024).to_string());
|
|
||||||
}
|
|
||||||
puffin_snapshot!(command, @r###"
|
|
||||||
success: true
|
|
||||||
exit_code: 0
|
|
||||||
----- stdout -----
|
|
||||||
|
|
||||||
----- stderr -----
|
|
||||||
Resolved 2 packages in [TIME]
|
|
||||||
Downloaded 2 packages in [TIME]
|
|
||||||
Installed 2 packages in [TIME]
|
|
||||||
+ jinja2==3.1.2
|
|
||||||
+ markupsafe==2.1.3
|
|
||||||
"###
|
|
||||||
);
|
|
||||||
|
|
||||||
context.assert_command("import jinja2").success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Install a package without using pre-built wheels for a subset of packages.
|
|
||||||
#[test]
|
|
||||||
fn install_no_binary_subset() {
|
|
||||||
let context = TestContext::new("3.12");
|
|
||||||
|
|
||||||
puffin_snapshot!(command(&context)
|
|
||||||
.arg("jinja2")
|
|
||||||
.arg("--no-binary")
|
|
||||||
.arg("jinja2")
|
|
||||||
.arg("--no-binary")
|
|
||||||
.arg("markupsafe")
|
|
||||||
.arg("--strict"), @r###"
|
|
||||||
success: true
|
|
||||||
exit_code: 0
|
|
||||||
----- stdout -----
|
|
||||||
|
|
||||||
----- stderr -----
|
|
||||||
Resolved 2 packages in [TIME]
|
|
||||||
Downloaded 2 packages in [TIME]
|
|
||||||
Installed 2 packages in [TIME]
|
|
||||||
+ jinja2==3.1.2
|
|
||||||
+ markupsafe==2.1.3
|
|
||||||
"###
|
|
||||||
);
|
|
||||||
|
|
||||||
context.assert_command("import jinja2").success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Install a package only using pre-built wheels.
|
|
||||||
#[test]
|
|
||||||
fn install_only_binary() {
|
|
||||||
let context = TestContext::new("3.12");
|
|
||||||
|
|
||||||
puffin_snapshot!(command(&context)
|
|
||||||
.arg("jinja2")
|
|
||||||
.arg("--only-binary")
|
|
||||||
.arg(":all:")
|
|
||||||
.arg("--strict"), @r###"
|
|
||||||
success: true
|
|
||||||
exit_code: 0
|
|
||||||
----- stdout -----
|
|
||||||
|
|
||||||
----- stderr -----
|
|
||||||
Resolved 2 packages in [TIME]
|
|
||||||
Downloaded 2 packages in [TIME]
|
|
||||||
Installed 2 packages in [TIME]
|
|
||||||
+ jinja2==3.1.2
|
|
||||||
+ markupsafe==2.1.3
|
|
||||||
"###
|
|
||||||
);
|
|
||||||
|
|
||||||
context.assert_command("import jinja2").success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Install a package only using pre-built wheels for a subset of packages.
|
|
||||||
#[test]
|
|
||||||
fn install_only_binary_subset() {
|
|
||||||
let context = TestContext::new("3.12");
|
|
||||||
|
|
||||||
puffin_snapshot!(command(&context)
|
|
||||||
.arg("jinja2")
|
|
||||||
.arg("--only-binary")
|
|
||||||
.arg("markupsafe")
|
|
||||||
.arg("--strict"), @r###"
|
|
||||||
success: true
|
|
||||||
exit_code: 0
|
|
||||||
----- stdout -----
|
|
||||||
|
|
||||||
----- stderr -----
|
|
||||||
Resolved 2 packages in [TIME]
|
|
||||||
Downloaded 2 packages in [TIME]
|
|
||||||
Installed 2 packages in [TIME]
|
|
||||||
+ jinja2==3.1.2
|
|
||||||
+ markupsafe==2.1.3
|
|
||||||
"###
|
|
||||||
);
|
|
||||||
|
|
||||||
context.assert_command("import jinja2").success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Install a package without using pre-built wheels.
|
/// Install a package without using pre-built wheels.
|
||||||
#[test]
|
#[test]
|
||||||
fn reinstall_no_binary() {
|
fn reinstall_no_binary() {
|
||||||
|
@ -782,7 +669,7 @@ fn reinstall_no_binary() {
|
||||||
|
|
||||||
// The first installation should use a pre-built wheel
|
// The first installation should use a pre-built wheel
|
||||||
let mut command = command(&context);
|
let mut command = command(&context);
|
||||||
command.arg("jinja2").arg("--strict");
|
command.arg("anyio").arg("--strict");
|
||||||
if cfg!(all(windows, debug_assertions)) {
|
if cfg!(all(windows, debug_assertions)) {
|
||||||
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
|
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
|
||||||
// default windows stack of 1MB
|
// default windows stack of 1MB
|
||||||
|
@ -794,21 +681,22 @@ fn reinstall_no_binary() {
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 2 packages in [TIME]
|
Resolved 3 packages in [TIME]
|
||||||
Downloaded 2 packages in [TIME]
|
Downloaded 3 packages in [TIME]
|
||||||
Installed 2 packages in [TIME]
|
Installed 3 packages in [TIME]
|
||||||
+ jinja2==3.1.2
|
+ anyio==4.0.0
|
||||||
+ markupsafe==2.1.3
|
+ idna==3.4
|
||||||
|
+ sniffio==1.3.0
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
||||||
context.assert_command("import jinja2").success();
|
context.assert_command("import anyio").success();
|
||||||
|
|
||||||
// Running installation again with `--no-binary` should be a no-op
|
// Running installation again with `--no-binary` should be a no-op
|
||||||
// The first installation should use a pre-built wheel
|
// The first installation should use a pre-built wheel
|
||||||
let mut command = crate::command(&context);
|
let mut command = crate::command(&context);
|
||||||
command
|
command
|
||||||
.arg("jinja2")
|
.arg("anyio")
|
||||||
.arg("--no-binary")
|
.arg("--no-binary")
|
||||||
.arg(":all:")
|
.arg(":all:")
|
||||||
.arg("--strict");
|
.arg("--strict");
|
||||||
|
@ -827,7 +715,7 @@ fn reinstall_no_binary() {
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
||||||
context.assert_command("import jinja2").success();
|
context.assert_command("import anyio").success();
|
||||||
|
|
||||||
// With `--reinstall`, `--no-binary` should have an affect
|
// With `--reinstall`, `--no-binary` should have an affect
|
||||||
let filters = if cfg!(windows) {
|
let filters = if cfg!(windows) {
|
||||||
|
@ -842,11 +730,11 @@ fn reinstall_no_binary() {
|
||||||
};
|
};
|
||||||
let mut command = crate::command(&context);
|
let mut command = crate::command(&context);
|
||||||
command
|
command
|
||||||
.arg("jinja2")
|
.arg("anyio")
|
||||||
.arg("--no-binary")
|
.arg("--no-binary")
|
||||||
.arg(":all:")
|
.arg(":all:")
|
||||||
.arg("--reinstall-package")
|
.arg("--reinstall-package")
|
||||||
.arg("jinja2")
|
.arg("anyio")
|
||||||
.arg("--strict");
|
.arg("--strict");
|
||||||
if cfg!(all(windows, debug_assertions)) {
|
if cfg!(all(windows, debug_assertions)) {
|
||||||
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
|
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
|
||||||
|
@ -859,14 +747,14 @@ fn reinstall_no_binary() {
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 2 packages in [TIME]
|
Resolved 3 packages in [TIME]
|
||||||
Installed 1 package in [TIME]
|
Installed 1 package in [TIME]
|
||||||
- jinja2==3.1.2
|
- anyio==4.0.0
|
||||||
+ jinja2==3.1.2
|
+ anyio==4.0.0
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
||||||
context.assert_command("import jinja2").success();
|
context.assert_command("import anyio").success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Install a package into a virtual environment, and ensuring that the executable permissions
|
/// Install a package into a virtual environment, and ensuring that the executable permissions
|
||||||
|
|
|
@ -808,44 +808,6 @@ fn install_numpy_py38() -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Install a package without using pre-built wheels.
|
|
||||||
#[test]
|
|
||||||
fn install_no_binary() -> Result<()> {
|
|
||||||
let context = TestContext::new("3.12");
|
|
||||||
|
|
||||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
|
||||||
requirements_txt.touch()?;
|
|
||||||
requirements_txt.write_str("MarkupSafe==2.1.3")?;
|
|
||||||
|
|
||||||
let mut command = command(&context);
|
|
||||||
command
|
|
||||||
.arg("requirements.txt")
|
|
||||||
.arg("--no-binary")
|
|
||||||
.arg(":all:")
|
|
||||||
.arg("--strict");
|
|
||||||
if cfg!(all(windows, debug_assertions)) {
|
|
||||||
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
|
|
||||||
// default windows stack of 1MB
|
|
||||||
command.env("PUFFIN_STACK_SIZE", (2 * 1024 * 1024).to_string());
|
|
||||||
}
|
|
||||||
puffin_snapshot!(command, @r###"
|
|
||||||
success: true
|
|
||||||
exit_code: 0
|
|
||||||
----- stdout -----
|
|
||||||
|
|
||||||
----- stderr -----
|
|
||||||
Resolved 1 package in [TIME]
|
|
||||||
Downloaded 1 package in [TIME]
|
|
||||||
Installed 1 package in [TIME]
|
|
||||||
+ markupsafe==2.1.3
|
|
||||||
"###
|
|
||||||
);
|
|
||||||
|
|
||||||
context.assert_command("import markupsafe").success();
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Attempt to install a package without using a remote index.
|
/// Attempt to install a package without using a remote index.
|
||||||
#[test]
|
#[test]
|
||||||
fn install_no_index() -> Result<()> {
|
fn install_no_index() -> Result<()> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue