mirror of https://github.com/astral-sh/ruff
Canonicalize path before filtering (#19407)
## Summary This came up on [Discord](https://discord.com/channels/1039017663004942429/1343692072921731082/1395447082520678440) and also in #19387, but on macOS the tmp directory is a symlink to `/private/tmp`, which breaks this filter. I'm still not quite sure why only these tests are affected when we use the `tempdir_filter` elsewhere, but hopefully this fixes the immediate issue. Just `tempdir.path().canonicalize()` also worked, but I used `dunce` since that's what I saw in other tests (I guess it's not _just_ these tests). Some related links from uv: -1b2f212e8b/crates/uv/tests/it/common/mod.rs (L1161-L1178)-1b2f212e8b/crates/uv/tests/it/common/mod.rs (L424-L438)- https://github.com/astral-sh/uv/pull/14290 Thanks to @zanieb for those! ## Test Plan I tested the `main` branch on my MacBook and reproduced the test failure, then confirmed that the tests pass after the change. Now to make sure it passes on Windows, which caused most of the trouble in the first PR!
This commit is contained in:
parent
ee2759b365
commit
1fd9103e81
|
|
@ -5718,8 +5718,11 @@ match 42: # invalid-syntax
|
||||||
|
|
||||||
let snapshot = format!("output_format_{output_format}");
|
let snapshot = format!("output_format_{output_format}");
|
||||||
|
|
||||||
|
let project_dir = dunce::canonicalize(tempdir.path())?;
|
||||||
|
|
||||||
insta::with_settings!({
|
insta::with_settings!({
|
||||||
filters => vec![
|
filters => vec![
|
||||||
|
(tempdir_filter(&project_dir).as_str(), "[TMP]/"),
|
||||||
(tempdir_filter(&tempdir).as_str(), "[TMP]/"),
|
(tempdir_filter(&tempdir).as_str(), "[TMP]/"),
|
||||||
(r#""[^"]+\\?/?input.py"#, r#""[TMP]/input.py"#),
|
(r#""[^"]+\\?/?input.py"#, r#""[TMP]/input.py"#),
|
||||||
(ruff_linter::VERSION, "[VERSION]"),
|
(ruff_linter::VERSION, "[VERSION]"),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue