mirror of
https://github.com/astral-sh/ruff
synced 2026-01-23 14:30:53 -05:00
Snapshot tests recently started reporting this warning: > Snapshot test passes but the existing value is in a legacy format. > Please run cargo insta test --force-update-snapshots to update to a > newer format. This PR is the result of that forced update. One file (crates/ruff_db/src/diagnostic/render/full.rs) seems to get corrupted, because it contains strings with unprintable characters that trigger some bug in cargo-insta. I've manually reverted that file, and also manually reverted the `input_file:` lines, which we like.
44 lines
1.0 KiB
Rust
44 lines
1.0 KiB
Rust
use insta_cmd::assert_cmd_snapshot;
|
|
|
|
use crate::CliTest;
|
|
|
|
/// ty ignores `type: ignore` comments when setting `respect-type-ignore-comments=false`
|
|
#[test]
|
|
fn respect_type_ignore_comments_is_turned_off() -> anyhow::Result<()> {
|
|
let case = CliTest::with_file(
|
|
"test.py",
|
|
r#"
|
|
y = a + 5 # type: ignore
|
|
"#,
|
|
)?;
|
|
|
|
// Assert that there's an `unresolved-reference` diagnostic (error).
|
|
assert_cmd_snapshot!(case.command(), @"
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
All checks passed!
|
|
|
|
----- stderr -----
|
|
");
|
|
|
|
assert_cmd_snapshot!(case.command().arg("--config").arg("analysis.respect-type-ignore-comments=false"), @"
|
|
success: false
|
|
exit_code: 1
|
|
----- stdout -----
|
|
error[unresolved-reference]: Name `a` used when not defined
|
|
--> test.py:2:5
|
|
|
|
|
2 | y = a + 5 # type: ignore
|
|
| ^
|
|
|
|
|
info: rule `unresolved-reference` is enabled by default
|
|
|
|
Found 1 diagnostic
|
|
|
|
----- stderr -----
|
|
");
|
|
|
|
Ok(())
|
|
}
|