From fb2382fbc3e69c0dd3f6ed7ebca11facc7b029b0 Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Thu, 12 Jan 2023 00:37:41 +0100 Subject: [PATCH] Update readme to reflect #1763 (#1780) When checking changes in the 0.0.218 release I noticed that auto fixing PT004 and PT005 was disabled but this change was not reflected in README. So I create this small PR to do this. Co-authored-by: Charlie Marsh --- README.md | 4 ++-- src/violations.rs | 12 ++---------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index d9f2e7a24a..fc42e55c16 100644 --- a/README.md +++ b/README.md @@ -920,8 +920,8 @@ For more, see [flake8-pytest-style](https://pypi.org/project/flake8-pytest-style | PT001 | IncorrectFixtureParenthesesStyle | Use `@pytest.fixture()` over `@pytest.fixture` | 🛠 | | PT002 | FixturePositionalArgs | Configuration for fixture `...` specified via positional args, use kwargs | | | PT003 | ExtraneousScopeFunction | `scope='function'` is implied in `@pytest.fixture()` | | -| PT004 | MissingFixtureNameUnderscore | Fixture `...` does not return anything, add leading underscore | 🛠 | -| PT005 | IncorrectFixtureNameUnderscore | Fixture `...` returns a value, remove leading underscore | 🛠 | +| PT004 | MissingFixtureNameUnderscore | Fixture `...` does not return anything, add leading underscore | | +| PT005 | IncorrectFixtureNameUnderscore | Fixture `...` returns a value, remove leading underscore | | | PT006 | ParametrizeNamesWrongType | Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 🛠 | | PT007 | ParametrizeValuesWrongType | Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | | | PT008 | PatchWithLambda | Use `return_value=` instead of patching with `lambda` | | diff --git a/src/violations.rs b/src/violations.rs index 644c21edfa..849a7b06e3 100644 --- a/src/violations.rs +++ b/src/violations.rs @@ -5439,16 +5439,12 @@ impl Violation for ExtraneousScopeFunction { define_violation!( pub struct MissingFixtureNameUnderscore(pub String); ); -impl AlwaysAutofixableViolation for MissingFixtureNameUnderscore { +impl Violation for MissingFixtureNameUnderscore { fn message(&self) -> String { let MissingFixtureNameUnderscore(function) = self; format!("Fixture `{function}` does not return anything, add leading underscore") } - fn autofix_title(&self) -> String { - "Add leading underscore".to_string() - } - fn placeholder() -> Self { MissingFixtureNameUnderscore("...".to_string()) } @@ -5457,16 +5453,12 @@ impl AlwaysAutofixableViolation for MissingFixtureNameUnderscore { define_violation!( pub struct IncorrectFixtureNameUnderscore(pub String); ); -impl AlwaysAutofixableViolation for IncorrectFixtureNameUnderscore { +impl Violation for IncorrectFixtureNameUnderscore { fn message(&self) -> String { let IncorrectFixtureNameUnderscore(function) = self; format!("Fixture `{function}` returns a value, remove leading underscore") } - fn autofix_title(&self) -> String { - "Remove leading underscore".to_string() - } - fn placeholder() -> Self { IncorrectFixtureNameUnderscore("...".to_string()) }