Skip to content

Commit 4fd07d0

Browse files
authored
Make range suppression test snapshot actually useful (#23251)
When range suppressions were stabilized in 0.15.0, this snapshot became empty/useless because there was no longer a difference between the normal and preview behaviors on the fixture file.
1 parent 8c63bce commit 4fd07d0

File tree

3 files changed

+403
-20
lines changed

3 files changed

+403
-20
lines changed

crates/ruff_linter/resources/test/fixtures/ruff/suppressions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def f():
4141

4242

4343
def f():
44-
# Neither of these are ignored and warnings are
45-
# logged to user
44+
# Neither of these are ignored and warnings are logged to user.
45+
# An usued suppression diagnostic should also be logged.
4646
# ruff: disable[E501]
4747
I = 1
4848
# ruff: enable[E501]

crates/ruff_linter/src/rules/ruff/mod.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ mod tests {
331331

332332
#[test]
333333
fn range_suppressions() -> Result<()> {
334-
assert_diagnostics_diff!(
334+
let diagnostics = test_path(
335335
Path::new("ruff/suppressions.py"),
336336
&settings::LinterSettings::for_rules(vec![
337337
Rule::UnusedVariable,
@@ -342,17 +342,8 @@ mod tests {
342342
Rule::UnmatchedSuppressionComment,
343343
])
344344
.with_external_rules(&["TK421"]),
345-
&settings::LinterSettings::for_rules(vec![
346-
Rule::UnusedVariable,
347-
Rule::AmbiguousVariableName,
348-
Rule::UnusedNOQA,
349-
Rule::InvalidRuleCode,
350-
Rule::InvalidSuppressionComment,
351-
Rule::UnmatchedSuppressionComment,
352-
])
353-
.with_external_rules(&["TK421"])
354-
.with_preview_mode(),
355-
);
345+
)?;
346+
assert_diagnostics!(diagnostics);
356347
Ok(())
357348
}
358349

0 commit comments

Comments
 (0)