Skip to content

Commit

Permalink
uv/tests: remove double-escaping
Browse files Browse the repository at this point in the history
And otherwise make the regexes a little more robust.
  • Loading branch information
BurntSushi committed Sep 3, 2024
1 parent 95d6312 commit 8403a6d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
8 changes: 4 additions & 4 deletions crates/uv/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1089,10 +1089,10 @@ pub fn run_and_format_with_status<T: AsRef<str>>(
if let Some(windows_filters) = windows_filters {
// The optional leading +/-/~ is for install logs, the optional next line is for lockfiles
let windows_only_deps = [
(r"( [-+~] )?colorama==\d+(\.[\d+])+( \n --hash=.*)?\n( # via .*\n)?"),
(r"( [-+~] )?colorama==\d+(\.[\d+])+(\s+# via .*)?\n"),
(r"( [-+~] )?tzdata==\d+(\.[\d+])+( \n --hash=.*)?\n( # via .*\n)?"),
(r"( [-+~] )?tzdata==\d+(\.[\d+])+(\s+# via .*)?\n"),
(r"( ?[-+~] ?)?colorama==\d+(\.\d+)+( [\\]\n\s+--hash=.*)?\n(\s+# via .*\n)?"),
(r"( ?[-+~] ?)?colorama==\d+(\.\d+)+(\s+[-+~]?\s+# via .*)?\n"),
(r"( ?[-+~] ?)?tzdata==\d+(\.\d+)+( [\\]\n\s+--hash=.*)?\n(\s+# via .*\n)?"),
(r"( ?[-+~] ?)?tzdata==\d+(\.\d+)+(\s+[-+~]?\s+# via .*)?\n"),
];
let mut removed_packages = 0;
for windows_only_dep in windows_only_deps {
Expand Down
18 changes: 15 additions & 3 deletions crates/uv/tests/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12193,6 +12193,20 @@ matplotlib
"warning: The requested Python version 3.8 is not available; .* will be used to build dependencies instead.\n",
"",
),
// For Windows, `tzdata` isn't included in the resolution.
//
// This should probably be investigated. It is possible this
// is a correct/expected result. For example, if there is a
// dependency that is sdist-only and has dynamic platform
// dependent dependencies. But if not, `tzdata` should still
// show up in the lock file.
//
// In any case, we filter `tzdata` out of the snapshot entirely
// on all platforms for this reason.
(r"( ?[-+~] ?)?tzdata==\d+(\.\d+)+(\s+[-+~]?\s+# via .*)?\n", ""),
// And because tzdata is omitted on Windows, the number of deps
// is different too. So filter that out too.
(r"Resolved 19 packages", "Resolved [NUM] packages"),
]
.into_iter()
.chain(context.filters())
Expand Down Expand Up @@ -12253,13 +12267,11 @@ matplotlib
# via python-dateutil
tomli==2.0.1 ; python_full_version <= '3.11'
# via coverage
tzdata==2024.1
# via pandas
zipp==3.18.1 ; python_full_version < '3.10'
# via importlib-resources
----- stderr -----
Resolved 19 packages in [TIME]
Resolved [NUM] packages in [TIME]
"###);

Ok(())
Expand Down

0 comments on commit 8403a6d

Please sign in to comment.