Skip to content

Commit

Permalink
Quote version parse errors consistently (#3325)
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb authored Apr 30, 2024
1 parent d57af51 commit 100dbe4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crates/pep440-rs/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2141,7 +2141,7 @@ impl std::fmt::Display for VersionParseError {
} => {
write!(
f,
"after parsing {version}, found {remaining:?} after it, \
"after parsing '{version}', found '{remaining}', \
which is not part of a valid version",
)
}
Expand Down
9 changes: 5 additions & 4 deletions crates/pep508-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1997,10 +1997,11 @@ mod tests {
fn error_invalid_prerelease() {
assert_snapshot!(
parse_pepe508_err("name==1.0.org1"),
@"
after parsing 1.0, found \".org1\" after it, which is not part of a valid version
name==1.0.org1
^^^^^^^^^^"
@r###"
after parsing '1.0', found '.org1', which is not part of a valid version
name==1.0.org1
^^^^^^^^^^
"###
);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/uv/tests/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ fn compile_python_invalid_version() -> Result<()> {
----- stdout -----
----- stderr -----
error: invalid value '3.7.x' for '--python-version <PYTHON_VERSION>': after parsing 3.7, found ".x" after it, which is not part of a valid version
error: invalid value '3.7.x' for '--python-version <PYTHON_VERSION>': after parsing '3.7', found '.x', which is not part of a valid version
For more information, try '--help'.
"###
Expand Down
4 changes: 2 additions & 2 deletions crates/uv/tests/pip_uninstall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn invalid_requirement() -> Result<()> {
----- stderr -----
error: Failed to parse `flask==1.0.x`
Caused by: after parsing 1.0, found ".x" after it, which is not part of a valid version
Caused by: after parsing '1.0', found '.x', which is not part of a valid version
flask==1.0.x
^^^^^^^
"###);
Expand Down Expand Up @@ -141,7 +141,7 @@ fn invalid_requirements_txt_requirement() -> Result<()> {
----- stderr -----
error: Couldn't parse requirement in `requirements.txt` at position 0
Caused by: after parsing 1.0, found ".x" after it, which is not part of a valid version
Caused by: after parsing '1.0', found '.x', which is not part of a valid version
flask==1.0.x
^^^^^^^
"###);
Expand Down

0 comments on commit 100dbe4

Please sign in to comment.