Skip to content

Commit bdc2f53

Browse files
committed
Try to fix zmypy tests for Windows
1 parent 55ca667 commit bdc2f53

File tree

1 file changed

+14
-26
lines changed

1 file changed

+14
-26
lines changed

crates/zmypy/src/lib.rs

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,7 @@ mod tests {
337337
// No venv information should fail to import
338338
assert_eq!(
339339
d(&[""]),
340-
[
341-
format!("m.py:1: {err}"),
342-
format!("test-dir{}n.py:1: {err}", std::path::MAIN_SEPARATOR),
343-
]
340+
[format!("m.py:1: {err}"), format!("test-dir/n.py:1: {err}"),]
344341
);
345342
// venv information via --python-executable should work
346343
let empty: [&str; _] = [];
@@ -381,29 +378,23 @@ mod tests {
381378
expect_diagnostics_error(Cli::parse_from(cli_args), test_dir.path().into())
382379
};
383380

384-
let err1 = format!(
385-
"foo{sep}bar{sep}mod1.py:1: error: \"int\" not callable [operator]",
386-
sep = std::path::MAIN_SEPARATOR
387-
);
388-
let err2 = format!(
389-
"foo{}mod2.py:1: error: \"int\" not callable [operator]",
390-
std::path::MAIN_SEPARATOR
391-
);
381+
let err1 = "foo/bar/mod1.py:1: error: \"int\" not callable [operator]";
382+
let err2 = "foo/mod2.py:1: error: \"int\" not callable [operator]";
392383
let err3 = "mod3.py:1: error: \"int\" not callable [operator]";
393384

394-
assert_eq!(d(&[""]), [&*err2]);
385+
assert_eq!(d(&[""]), [err2]);
395386

396-
assert_eq!(d(&["", "foo/**/mod[1-9].py"]), [&*err1, &*err2]);
397-
assert_eq!(d(&["", "**/*.py"]), [&*err1, &*err2, err3]);
398-
assert_eq!(d(&["", "**/mod2.py"]), [&*err2]);
399-
assert_eq!(d(&["", "**/"]), [&*err1, &*err2, err3]);
400-
assert_eq!(d(&["", "**/mod?.py"]), [&*err1, &*err2, err3]);
387+
assert_eq!(d(&["", "foo/**/mod[1-9].py"]), [err1, err2]);
388+
assert_eq!(d(&["", "**/*.py"]), [err1, err2, err3]);
389+
assert_eq!(d(&["", "**/mod2.py"]), [err2]);
390+
assert_eq!(d(&["", "**/"]), [err1, err2, err3]);
391+
assert_eq!(d(&["", "**/mod?.py"]), [err1, err2, err3]);
401392
assert_eq!(d(&["", "*.py"]), [err3]);
402-
assert_eq!(d(&["", "foo"]), [&*err1, &*err2]);
403-
assert_eq!(d(&["", "./foo"]), [&*err1, &*err2]);
404-
assert_eq!(d(&["", "does-not-exist/../foo"]), [&*err1, &*err2]);
393+
assert_eq!(d(&["", "foo"]), [err1, err2]);
394+
assert_eq!(d(&["", "./foo"]), [err1, err2]);
395+
assert_eq!(d(&["", "does-not-exist/../foo"]), [err1, err2]);
405396
// Same file twice
406-
assert_eq!(d(&["", "foo", "foo/mod2.py"]), [&*err1, &*err2]);
397+
assert_eq!(d(&["", "foo", "foo/mod2.py"]), [err1, err2]);
407398

408399
expect_not_found(&["", "foo", "undefined-path"]);
409400
if cfg!(windows) {
@@ -571,10 +562,7 @@ mod tests {
571562

572563
assert_eq!(
573564
d(&["", "foo/no_py_ending"]),
574-
[format!(
575-
"foo{}no_py_ending:1: error: \"int\" not callable [operator]",
576-
std::path::MAIN_SEPARATOR
577-
)]
565+
["foo/no_py_ending:1: error: \"int\" not callable [operator]",]
578566
);
579567
assert!(err(&["", "foo/"]).starts_with("No Python files found to check for"));
580568
assert_eq!(err(&[""]), "No Python files found to check");

0 commit comments

Comments
 (0)