Skip to content

Commit

Permalink
Remove preview-only test group
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser committed Nov 27, 2024
1 parent b3dc296 commit 01f5b7f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 22 deletions.
20 changes: 1 addition & 19 deletions crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mod tests {
use crate::assert_messages;
use crate::registry::Rule;
use crate::settings;
use crate::settings::types::PreviewMode;
use crate::test::test_path;

#[test_case(Path::new("full_name.py"))]
Expand Down Expand Up @@ -64,6 +63,7 @@ mod tests {
#[test_case(Rule::OsPathGetctime, Path::new("PTH205.py"))]
#[test_case(Rule::OsSepSplit, Path::new("PTH206.py"))]
#[test_case(Rule::Glob, Path::new("PTH207.py"))]
#[test_case(Rule::OsListdir, Path::new("PTH208.py"))]
fn rules_pypath(rule_code: Rule, path: &Path) -> Result<()> {
let snapshot = format!("{}_{}", rule_code.noqa_code(), path.to_string_lossy());
let diagnostics = test_path(
Expand All @@ -73,22 +73,4 @@ mod tests {
assert_messages!(snapshot, diagnostics);
Ok(())
}

#[test_case(Rule::OsListdir, Path::new("PTH208.py"))]
fn preview_rules_pth(rule_code: Rule, path: &Path) -> Result<()> {
let snapshot = format!(
"preview__{}_{}",
rule_code.noqa_code(),
path.to_string_lossy()
);
let diagnostics = test_path(
Path::new("flake8_use_pathlib").join(path).as_path(),
&settings::LinterSettings {
preview: PreviewMode::Enabled,
..settings::LinterSettings::for_rule(rule_code)
},
)?;
assert_messages!(snapshot, diagnostics);
Ok(())
}
}
6 changes: 3 additions & 3 deletions crates/ruff_linter/src/rules/flake8_use_pathlib/violations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ impl Violation for PyPath {
/// ## Why is this bad?
/// `pathlib` offers a high-level API for path manipulation, as compared to
/// the lower-level API offered by `os`. When possible, using `pathlib`'s
/// `Path.iterdir()` can improve readability over `os`'s `listdir()`.
/// `Path.iterdir()` can improve readability over `os.listdir()`.
///
/// ## Example
///
Expand Down Expand Up @@ -1139,8 +1139,8 @@ impl Violation for PyPath {
/// if (p / "file").exists():
/// ...
/// ```
#[violation]
pub struct OsListdir;
#[derive(ViolationMetadata)]
pub(crate) struct OsListdir;

impl Violation for OsListdir {
#[derive_message_formats]
Expand Down

0 comments on commit 01f5b7f

Please sign in to comment.