Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rust crate fs-err to v3 #8625

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 38 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ either = { version = "1.13.0" }
encoding_rs_io = { version = "0.1.7" }
etcetera = { version = "0.8.0" }
flate2 = { version = "1.0.33", default-features = false }
fs-err = { version = "2.11.0" }
fs-err = { version = "3.0.0" }
fs2 = { version = "0.4.3" }
futures = { version = "0.3.30" }
glob = { version = "0.3.1" }
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-build-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ workspace = true

[dev-dependencies]
indoc = { version = "2.0.5" }
insta = { version = "1.40.0" }
insta = { version = "1.40.0", features = ["filters"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

tempfile = { version = "3.12.0" }
11 changes: 9 additions & 2 deletions crates/uv-build-backend/src/metadata/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,15 @@ fn missing_readme() {
.unwrap()
.to_metadata(Path::new("/do/not/read"))
.unwrap_err();
// Simplified for windows compatibility.
assert_snapshot!(err.to_string().replace('\\', "/"), @"failed to open file `/do/not/read/Readme.md`");
// Strip away OS specific part.
let err = err
.to_string()
.replace('\\', "/")
.split_once(':')
.unwrap()
.0
.to_string();
assert_snapshot!(err, @"failed to open file `/do/not/read/Readme.md`");
}

#[test]
Expand Down
8 changes: 7 additions & 1 deletion crates/uv-requirements-txt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1406,13 +1406,19 @@ mod test {
let filters = vec![
(requirement_txt.as_str(), "<REQUIREMENTS_TXT>"),
(missing_txt.as_str(), "<MISSING_TXT>"),
// Windows translates error messages, for example i get:
// "Das System kann den angegebenen Pfad nicht finden. (os error 3)"
(
r": .* \(os error 2\)",
": The system cannot find the path specified. (os error 2)",
),
];
insta::with_settings!({
filters => filters,
}, {
insta::assert_snapshot!(errors, @r###"
Error parsing included file in `<REQUIREMENTS_TXT>` at position 0
failed to read from file `<MISSING_TXT>`
failed to read from file `<MISSING_TXT>`: The system cannot find the path specified. (os error 2)
"###);
});

Expand Down
4 changes: 2 additions & 2 deletions crates/uv-trampoline/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/uv-trampoline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ embed-manifest = "1.4.0"
anyhow = { version = "1.0.80" }
assert_cmd = { version = "2.0.14" }
assert_fs = { version = "1.1.1" }
fs-err = { version = "2.11.0" }
fs-err = { version = "3.0.0" }
thiserror = { version = "1.0.56" }
which = { version = "6.0.0" }
zip = { version = "0.6.6", default-features = false, features = ["deflate"] }
3 changes: 1 addition & 2 deletions crates/uv/tests/it/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2567,8 +2567,7 @@ fn run_script_explicit_directory() -> Result<()> {
----- stdout -----

----- stderr -----
error: failed to read from file `script`
Caused by: Is a directory (os error 21)
error: failed to read from file `script`: Is a directory (os error 21)
"###);

Ok(())
Expand Down
9 changes: 4 additions & 5 deletions crates/uv/tests/it/venv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,10 +1032,10 @@ fn path_with_trailing_space_gives_proper_error() {
let path_with_trailing_slash = format!("{} ", context.cache_dir.path().display());
let mut filters = context.filters();
// Windows translates error messages, for example i get:
// "Caused by: Das System kann den angegebenen Pfad nicht finden. (os error 3)"
// ": Das System kann den angegebenen Pfad nicht finden. (os error 3)"
filters.push((
r"Caused by: .* \(os error 3\)",
"Caused by: The system cannot find the path specified. (os error 3)",
r"CACHEDIR.TAG`: .* \(os error 3\)",
"CACHEDIR.TAG`: The system cannot find the path specified. (os error 3)",
Comment on lines -1035 to +1038
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside: I bet this can be simplified now that we do #8606

));
uv_snapshot!(filters, std::process::Command::new(crate::common::get_bin())
.arg("venv")
Expand All @@ -1045,8 +1045,7 @@ fn path_with_trailing_space_gives_proper_error() {
----- stdout -----

----- stderr -----
error: failed to open file `[CACHE_DIR]/ /CACHEDIR.TAG`
Caused by: The system cannot find the path specified. (os error 3)
error: failed to open file `[CACHE_DIR]/ /CACHEDIR.TAG`: The system cannot find the path specified. (os error 3)
"###
);
// Note the extra trailing `/` in the snapshot is due to the filters, not the actual output.
Expand Down
Loading