mirror of https://github.com/astral-sh/uv
Avoid multiple dependencies in `verify_hashes_mismatch` (#9207)
## Summary Last time, I swear.
This commit is contained in:
parent
465588f6c1
commit
f1554c5ecd
|
|
@ -6202,24 +6202,16 @@ fn verify_hashes_missing_version() -> Result<()> {
|
||||||
fn verify_hashes_mismatch() -> Result<()> {
|
fn verify_hashes_mismatch() -> Result<()> {
|
||||||
let context = TestContext::new("3.12");
|
let context = TestContext::new("3.12");
|
||||||
|
|
||||||
// Write to a requirements file.
|
|
||||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||||
requirements_txt.write_str(indoc::indoc! {r"
|
requirements_txt.write_str(indoc::indoc! {r"
|
||||||
anyio==4.0.0 \
|
|
||||||
--hash=sha256:afdb2b588b9fc25ede96d8db56ed50848b0b649dca3dd1df0b11f683bb9e0b5f \
|
|
||||||
--hash=sha256:a7ed51751b2c2add651e5747c891b47e26d2a21be5d32d9311dfe9692f3e5d7a
|
|
||||||
idna==3.6 \
|
idna==3.6 \
|
||||||
--hash=sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca \
|
|
||||||
--hash=sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f
|
|
||||||
# via anyio
|
|
||||||
sniffio==1.3.1 \
|
|
||||||
--hash=sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2 \
|
--hash=sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2 \
|
||||||
--hash=sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc
|
--hash=sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc
|
||||||
# via anyio
|
|
||||||
"})?;
|
"})?;
|
||||||
|
|
||||||
// Raise an error.
|
// Raise an error.
|
||||||
uv_snapshot!(context.pip_install()
|
uv_snapshot!(context.pip_install()
|
||||||
|
.arg("--no-deps")
|
||||||
.arg("-r")
|
.arg("-r")
|
||||||
.arg("requirements.txt")
|
.arg("requirements.txt")
|
||||||
.arg("--verify-hashes"), @r###"
|
.arg("--verify-hashes"), @r###"
|
||||||
|
|
@ -6228,16 +6220,32 @@ fn verify_hashes_mismatch() -> Result<()> {
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 3 packages in [TIME]
|
Resolved 1 package in [TIME]
|
||||||
× Failed to download `anyio==4.0.0`
|
× Failed to download `idna==3.6`
|
||||||
╰─▶ Hash mismatch for `anyio==4.0.0`
|
╰─▶ Hash mismatch for `idna==3.6`
|
||||||
|
|
||||||
Expected:
|
Expected:
|
||||||
sha256:afdb2b588b9fc25ede96d8db56ed50848b0b649dca3dd1df0b11f683bb9e0b5f
|
sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2
|
||||||
sha256:a7ed51751b2c2add651e5747c891b47e26d2a21be5d32d9311dfe9692f3e5d7a
|
sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc
|
||||||
|
|
||||||
Computed:
|
Computed:
|
||||||
sha256:cfdb2b588b9fc25ede96d8db56ed50848b0b649dca3dd1df0b11f683bb9e0b5f
|
sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f
|
||||||
|
"###
|
||||||
|
);
|
||||||
|
|
||||||
|
uv_snapshot!(context.pip_install()
|
||||||
|
.arg("--no-deps")
|
||||||
|
.arg("-r")
|
||||||
|
.arg("requirements.txt")
|
||||||
|
.arg("--no-verify-hashes"), @r###"
|
||||||
|
success: true
|
||||||
|
exit_code: 0
|
||||||
|
----- stdout -----
|
||||||
|
|
||||||
|
----- stderr -----
|
||||||
|
Resolved 1 package in [TIME]
|
||||||
|
Installed 1 package in [TIME]
|
||||||
|
+ idna==3.6
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -6249,57 +6257,26 @@ fn verify_hashes_mismatch() -> Result<()> {
|
||||||
fn verify_hashes_match() -> Result<()> {
|
fn verify_hashes_match() -> Result<()> {
|
||||||
let context = TestContext::new("3.12");
|
let context = TestContext::new("3.12");
|
||||||
|
|
||||||
// Write to a requirements file.
|
|
||||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||||
requirements_txt.write_str(indoc::indoc! {r"
|
requirements_txt.write_str(indoc::indoc! {r"
|
||||||
anyio==4.0.0 \
|
|
||||||
--hash=sha256:afdb2b588b9fc25ede96d8db56ed50848b0b649dca3dd1df0b11f683bb9e0b5f \
|
|
||||||
--hash=sha256:a7ed51751b2c2add651e5747c891b47e26d2a21be5d32d9311dfe9692f3e5d7a
|
|
||||||
idna==3.6 \
|
idna==3.6 \
|
||||||
--hash=sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca \
|
--hash=sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca \
|
||||||
--hash=sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f
|
--hash=sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f
|
||||||
# via anyio
|
|
||||||
sniffio==1.3.1 \
|
|
||||||
--hash=sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2 \
|
|
||||||
--hash=sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc
|
|
||||||
# via anyio
|
|
||||||
"})?;
|
"})?;
|
||||||
|
|
||||||
uv_snapshot!(context.pip_install()
|
uv_snapshot!(context.pip_install()
|
||||||
|
.arg("--no-deps")
|
||||||
.arg("-r")
|
.arg("-r")
|
||||||
.arg("requirements.txt"), @r###"
|
.arg("requirements.txt"), @r###"
|
||||||
success: false
|
|
||||||
exit_code: 1
|
|
||||||
----- stdout -----
|
|
||||||
|
|
||||||
----- stderr -----
|
|
||||||
Resolved 3 packages in [TIME]
|
|
||||||
× Failed to download `anyio==4.0.0`
|
|
||||||
╰─▶ Hash mismatch for `anyio==4.0.0`
|
|
||||||
|
|
||||||
Expected:
|
|
||||||
sha256:afdb2b588b9fc25ede96d8db56ed50848b0b649dca3dd1df0b11f683bb9e0b5f
|
|
||||||
sha256:a7ed51751b2c2add651e5747c891b47e26d2a21be5d32d9311dfe9692f3e5d7a
|
|
||||||
|
|
||||||
Computed:
|
|
||||||
sha256:cfdb2b588b9fc25ede96d8db56ed50848b0b649dca3dd1df0b11f683bb9e0b5f
|
|
||||||
"###
|
|
||||||
);
|
|
||||||
|
|
||||||
uv_snapshot!(context.pip_install()
|
|
||||||
.arg("-r")
|
|
||||||
.arg("requirements.txt")
|
|
||||||
.arg("--no-verify-hashes"), @r###"
|
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 3 packages in [TIME]
|
Resolved 1 package in [TIME]
|
||||||
Installed 3 packages in [TIME]
|
Prepared 1 package in [TIME]
|
||||||
+ anyio==4.0.0
|
Installed 1 package in [TIME]
|
||||||
+ idna==3.6
|
+ idna==3.6
|
||||||
+ sniffio==1.3.1
|
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue