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 <charlie.r.marsh@gmail.com>
This commit is contained in:
Grzegorz Bokota 2023-01-12 00:37:41 +01:00 committed by GitHub
parent c92a5a8704
commit fb2382fbc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 12 deletions

View File

@ -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` | 🛠 | | PT001 | IncorrectFixtureParenthesesStyle | Use `@pytest.fixture()` over `@pytest.fixture` | 🛠 |
| PT002 | FixturePositionalArgs | Configuration for fixture `...` specified via positional args, use kwargs | | | PT002 | FixturePositionalArgs | Configuration for fixture `...` specified via positional args, use kwargs | |
| PT003 | ExtraneousScopeFunction | `scope='function'` is implied in `@pytest.fixture()` | | | PT003 | ExtraneousScopeFunction | `scope='function'` is implied in `@pytest.fixture()` | |
| PT004 | MissingFixtureNameUnderscore | Fixture `...` does not return anything, add leading underscore | 🛠 | | PT004 | MissingFixtureNameUnderscore | Fixture `...` does not return anything, add leading underscore | |
| PT005 | IncorrectFixtureNameUnderscore | Fixture `...` returns a value, remove leading underscore | 🛠 | | PT005 | IncorrectFixtureNameUnderscore | Fixture `...` returns a value, remove leading underscore | |
| PT006 | ParametrizeNamesWrongType | Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 🛠 | | 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` | | | PT007 | ParametrizeValuesWrongType | Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | |
| PT008 | PatchWithLambda | Use `return_value=` instead of patching with `lambda` | | | PT008 | PatchWithLambda | Use `return_value=` instead of patching with `lambda` | |

View File

@ -5439,16 +5439,12 @@ impl Violation for ExtraneousScopeFunction {
define_violation!( define_violation!(
pub struct MissingFixtureNameUnderscore(pub String); pub struct MissingFixtureNameUnderscore(pub String);
); );
impl AlwaysAutofixableViolation for MissingFixtureNameUnderscore { impl Violation for MissingFixtureNameUnderscore {
fn message(&self) -> String { fn message(&self) -> String {
let MissingFixtureNameUnderscore(function) = self; let MissingFixtureNameUnderscore(function) = self;
format!("Fixture `{function}` does not return anything, add leading underscore") format!("Fixture `{function}` does not return anything, add leading underscore")
} }
fn autofix_title(&self) -> String {
"Add leading underscore".to_string()
}
fn placeholder() -> Self { fn placeholder() -> Self {
MissingFixtureNameUnderscore("...".to_string()) MissingFixtureNameUnderscore("...".to_string())
} }
@ -5457,16 +5453,12 @@ impl AlwaysAutofixableViolation for MissingFixtureNameUnderscore {
define_violation!( define_violation!(
pub struct IncorrectFixtureNameUnderscore(pub String); pub struct IncorrectFixtureNameUnderscore(pub String);
); );
impl AlwaysAutofixableViolation for IncorrectFixtureNameUnderscore { impl Violation for IncorrectFixtureNameUnderscore {
fn message(&self) -> String { fn message(&self) -> String {
let IncorrectFixtureNameUnderscore(function) = self; let IncorrectFixtureNameUnderscore(function) = self;
format!("Fixture `{function}` returns a value, remove leading underscore") format!("Fixture `{function}` returns a value, remove leading underscore")
} }
fn autofix_title(&self) -> String {
"Remove leading underscore".to_string()
}
fn placeholder() -> Self { fn placeholder() -> Self {
IncorrectFixtureNameUnderscore("...".to_string()) IncorrectFixtureNameUnderscore("...".to_string())
} }