mirror of https://github.com/astral-sh/uv
Fix tests
This commit is contained in:
parent
0b8c764d4e
commit
936b1cff03
|
|
@ -621,11 +621,59 @@ impl Cache {
|
||||||
match fs_err::read_dir(self.bucket(CacheBucket::Archive)) {
|
match fs_err::read_dir(self.bucket(CacheBucket::Archive)) {
|
||||||
Ok(entries) => {
|
Ok(entries) => {
|
||||||
for entry in entries {
|
for entry in entries {
|
||||||
|
|
||||||
let entry = entry?;
|
let entry = entry?;
|
||||||
let path = fs_err::canonicalize(entry.path())?;
|
|
||||||
if !references.contains_key(&path) {
|
// If two hex characters, it's a prefix; recurse.
|
||||||
debug!("Removing dangling cache archive: {}", path.display());
|
if entry
|
||||||
summary += rm_rf(path)?;
|
.file_name()
|
||||||
|
.to_str()
|
||||||
|
.is_some_and(|name| name.len() == 2 && name.chars().all(|c| c.is_ascii_hexdigit()))
|
||||||
|
{
|
||||||
|
match fs_err::read_dir(entry.path()) {
|
||||||
|
Ok(subentries) => {
|
||||||
|
for subentry in subentries {
|
||||||
|
let subentry = subentry?;
|
||||||
|
|
||||||
|
// If two hex characters, it's a prefix; recurse.
|
||||||
|
if subentry
|
||||||
|
.file_name()
|
||||||
|
.to_str()
|
||||||
|
.is_some_and(|name| name.len() == 2 && name.chars().all(|c| c.is_ascii_hexdigit()))
|
||||||
|
{
|
||||||
|
match fs_err::read_dir(subentry.path()) {
|
||||||
|
Ok(subsubentries) => {
|
||||||
|
for subsubentry in subsubentries {
|
||||||
|
let subsubentry = subsubentry?;
|
||||||
|
|
||||||
|
let path = fs_err::canonicalize(subsubentry.path())?;
|
||||||
|
if !references.contains_key(&path) {
|
||||||
|
debug!("Removing dangling cache archive: {}", path.display());
|
||||||
|
summary += rm_rf(path)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) if err.kind() == io::ErrorKind::NotFound => (),
|
||||||
|
Err(err) => return Err(err),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let path = fs_err::canonicalize(subentry.path())?;
|
||||||
|
if !references.contains_key(&path) {
|
||||||
|
debug!("Removing dangling cache archive: {}", path.display());
|
||||||
|
summary += rm_rf(path)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) if err.kind() == io::ErrorKind::NotFound => (),
|
||||||
|
Err(err) => return Err(err),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let path = fs_err::canonicalize(entry.path())?;
|
||||||
|
if !references.contains_key(&path) {
|
||||||
|
debug!("Removing dangling cache archive: {}", path.display());
|
||||||
|
summary += rm_rf(path)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -845,7 +845,7 @@ impl TestContext {
|
||||||
));
|
));
|
||||||
// Filter archive hashes
|
// Filter archive hashes
|
||||||
filters.push((
|
filters.push((
|
||||||
r"archive-v(\d+)[\\/][A-Za-z0-9\-\_]+".to_string(),
|
r"archive-v(\d+)[\\/][0-9a-f]{2}[\\/][0-9a-f]{2}[\\/][0-9a-f]{60}".to_string(),
|
||||||
"archive-v$1/[HASH]".to_string(),
|
"archive-v$1/[HASH]".to_string(),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3762,7 +3762,7 @@ fn require_hashes_wrong_algorithm() -> Result<()> {
|
||||||
|
|
||||||
uv_snapshot!(context.pip_sync()
|
uv_snapshot!(context.pip_sync()
|
||||||
.arg("requirements.txt")
|
.arg("requirements.txt")
|
||||||
.arg("--require-hashes"), @r###"
|
.arg("--require-hashes"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 1
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
@ -3776,8 +3776,9 @@ fn require_hashes_wrong_algorithm() -> Result<()> {
|
||||||
sha512:cfdb2b588b9fc25ede96d8db56ed50848b0b649dca3dd1df0b11f683bb9e0b5f
|
sha512:cfdb2b588b9fc25ede96d8db56ed50848b0b649dca3dd1df0b11f683bb9e0b5f
|
||||||
|
|
||||||
Computed:
|
Computed:
|
||||||
|
sha256:cfdb2b588b9fc25ede96d8db56ed50848b0b649dca3dd1df0b11f683bb9e0b5f
|
||||||
sha512:f30761c1e8725b49c498273b90dba4b05c0fd157811994c806183062cb6647e773364ce45f0e1ff0b10e32fe6d0232ea5ad39476ccf37109d6b49603a09c11c2
|
sha512:f30761c1e8725b49c498273b90dba4b05c0fd157811994c806183062cb6647e773364ce45f0e1ff0b10e32fe6d0232ea5ad39476ccf37109d6b49603a09c11c2
|
||||||
"###
|
"
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -4463,7 +4464,7 @@ fn require_hashes_repeated_hash() -> Result<()> {
|
||||||
uv_snapshot!(context.pip_sync()
|
uv_snapshot!(context.pip_sync()
|
||||||
.arg("requirements.txt")
|
.arg("requirements.txt")
|
||||||
.arg("--require-hashes")
|
.arg("--require-hashes")
|
||||||
.arg("--reinstall"), @r###"
|
.arg("--reinstall"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 1
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
@ -4478,7 +4479,8 @@ fn require_hashes_repeated_hash() -> Result<()> {
|
||||||
|
|
||||||
Computed:
|
Computed:
|
||||||
md5:420d85e19168705cdf0223621b18831a
|
md5:420d85e19168705cdf0223621b18831a
|
||||||
"###
|
sha256:cfdb2b588b9fc25ede96d8db56ed50848b0b649dca3dd1df0b11f683bb9e0b5f
|
||||||
|
"
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
|
|
@ -9117,7 +9117,6 @@ fn sync_all_extras() -> Result<()> {
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 8 packages in [TIME]
|
Resolved 8 packages in [TIME]
|
||||||
Prepared 1 package in [TIME]
|
|
||||||
Uninstalled 2 packages in [TIME]
|
Uninstalled 2 packages in [TIME]
|
||||||
Installed 1 package in [TIME]
|
Installed 1 package in [TIME]
|
||||||
+ packaging==24.0
|
+ packaging==24.0
|
||||||
|
|
@ -9759,7 +9758,7 @@ fn sync_stale_egg_info() -> Result<()> {
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 4 packages in [TIME]
|
Resolved 4 packages in [TIME]
|
||||||
Prepared 3 packages in [TIME]
|
Prepared 2 packages in [TIME]
|
||||||
Installed 3 packages in [TIME]
|
Installed 3 packages in [TIME]
|
||||||
+ member==0.1.dev5+gfea1041 (from git+https://github.com/astral-sh/uv-stale-egg-info-test.git@fea10416b9c479ac88fb217e14e40249b63bfbee#subdirectory=member)
|
+ member==0.1.dev5+gfea1041 (from git+https://github.com/astral-sh/uv-stale-egg-info-test.git@fea10416b9c479ac88fb217e14e40249b63bfbee#subdirectory=member)
|
||||||
+ root==0.1.dev5+gfea1041 (from git+https://github.com/astral-sh/uv-stale-egg-info-test.git@fea10416b9c479ac88fb217e14e40249b63bfbee)
|
+ root==0.1.dev5+gfea1041 (from git+https://github.com/astral-sh/uv-stale-egg-info-test.git@fea10416b9c479ac88fb217e14e40249b63bfbee)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue