mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
Add regression test for parent noqa
(#17783)
Summary -- Adds a regression test for #2253 after I tried to delete the fix from #2464.
This commit is contained in:
parent
91481a8be7
commit
c4a08782cc
1 changed files with 34 additions and 0 deletions
|
@ -1900,6 +1900,40 @@ def first_square():
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Regression test for <https://github.com/astral-sh/ruff/issues/2253>
|
||||
#[test]
|
||||
fn add_noqa_parent() -> Result<()> {
|
||||
let tempdir = TempDir::new()?;
|
||||
let test_path = tempdir.path().join("noqa.py");
|
||||
fs::write(
|
||||
&test_path,
|
||||
r#"
|
||||
from foo import ( # noqa: F401
|
||||
bar
|
||||
)
|
||||
"#,
|
||||
)?;
|
||||
|
||||
insta::with_settings!({
|
||||
filters => vec![(tempdir_filter(&tempdir).as_str(), "[TMP]/")]
|
||||
}, {
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(STDIN_BASE_OPTIONS)
|
||||
.arg("--add-noqa")
|
||||
.arg("--select=F401")
|
||||
.arg("noqa.py")
|
||||
.current_dir(&tempdir), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Infer `3.11` from `requires-python` in `pyproject.toml`.
|
||||
#[test]
|
||||
fn requires_python() -> Result<()> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue