Add more backticks to flake8-pytest-style error messages (#1707)

This commit is contained in:
Harutaka Kawamura 2023-01-07 12:55:24 +09:00 committed by GitHub
parent 3abd205f94
commit 8c836aeecf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -918,20 +918,20 @@ For more, see [flake8-pytest-style](https://pypi.org/project/flake8-pytest-style
| 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` | |
| PT009 | UnittestAssertion | Use a regular assert instead of unittest-style '...' | | | PT009 | UnittestAssertion | Use a regular `assert` instead of unittest-style `...` | |
| PT010 | RaisesWithoutException | set the expected exception in `pytest.raises()` | | | PT010 | RaisesWithoutException | set the expected exception in `pytest.raises()` | |
| PT011 | RaisesTooBroad | `pytest.raises(...)` is too broad, set the `match` parameter or use a more specific exception | | | PT011 | RaisesTooBroad | `pytest.raises(...)` is too broad, set the `match` parameter or use a more specific exception | |
| PT012 | RaisesWithMultipleStatements | `pytest.raises()` block should contain a single simple statement | | | PT012 | RaisesWithMultipleStatements | `pytest.raises()` block should contain a single simple statement | |
| PT013 | IncorrectPytestImport | Found incorrect import of pytest, use simple `import pytest` instead | | | PT013 | IncorrectPytestImport | Found incorrect import of pytest, use simple `import pytest` instead | |
| PT015 | AssertAlwaysFalse | Assertion always fails, replace with `pytest.fail()` | | | PT015 | AssertAlwaysFalse | Assertion always fails, replace with `pytest.fail()` | |
| PT016 | FailWithoutMessage | No message passed to `pytest.fail()` | | | PT016 | FailWithoutMessage | No message passed to `pytest.fail()` | |
| PT017 | AssertInExcept | Found assertion on exception ... in except block, use pytest.raises() instead | | | PT017 | AssertInExcept | Found assertion on exception `...` in except block, use `pytest.raises()` instead | |
| PT018 | CompositeAssertion | Assertion should be broken down into multiple parts | | | PT018 | CompositeAssertion | Assertion should be broken down into multiple parts | |
| PT019 | FixtureParamWithoutValue | Fixture ... without value is injected as parameter, use @pytest.mark.usefixtures instead | | | PT019 | FixtureParamWithoutValue | Fixture `...` without value is injected as parameter, use `@pytest.mark.usefixtures` instead | |
| PT020 | DeprecatedYieldFixture | `@pytest.yield_fixture` is deprecated, use `@pytest.fixture` | | | PT020 | DeprecatedYieldFixture | `@pytest.yield_fixture` is deprecated, use `@pytest.fixture` | |
| PT021 | FixtureFinalizerCallback | Use `yield` instead of `request.addfinalizer` | | | PT021 | FixtureFinalizerCallback | Use `yield` instead of `request.addfinalizer` | |
| PT022 | UselessYieldFixture | No teardown in fixture ..., use `return` instead of `yield` | 🛠 | | PT022 | UselessYieldFixture | No teardown in fixture `...`, use `return` instead of `yield` | 🛠 |
| PT023 | IncorrectMarkParenthesesStyle | Use `@pytest.mark....` over `@pytest.mark....()` | 🛠 | | PT023 | IncorrectMarkParenthesesStyle | Use `@pytest.mark....` over `@pytest.mark....()` | 🛠 |
| PT024 | UnnecessaryAsyncioMarkOnFixture | `pytest.mark.asyncio` is unnecessary for fixtures | | | PT024 | UnnecessaryAsyncioMarkOnFixture | `pytest.mark.asyncio` is unnecessary for fixtures | |
| PT025 | ErroneousUseFixturesOnFixture | `pytest.mark.usefixtures` has no effect on fixtures | | | PT025 | ErroneousUseFixturesOnFixture | `pytest.mark.usefixtures` has no effect on fixtures | |

View File

@ -3526,10 +3526,10 @@ impl CheckKind {
) )
} }
CheckKind::PatchWithLambda => { CheckKind::PatchWithLambda => {
"Use `return_value=` instead of patching with lambda".to_string() "Use `return_value=` instead of patching with `lambda`".to_string()
} }
CheckKind::UnittestAssertion(assertion) => { CheckKind::UnittestAssertion(assertion) => {
format!("Use a regular assert instead of unittest-style '{assertion}'") format!("Use a regular `assert` instead of unittest-style `{assertion}`")
} }
CheckKind::RaisesWithoutException => { CheckKind::RaisesWithoutException => {
"set the expected exception in `pytest.raises()`".to_string() "set the expected exception in `pytest.raises()`".to_string()
@ -3552,7 +3552,7 @@ impl CheckKind {
CheckKind::FailWithoutMessage => "No message passed to `pytest.fail()`".to_string(), CheckKind::FailWithoutMessage => "No message passed to `pytest.fail()`".to_string(),
CheckKind::AssertInExcept(name) => { CheckKind::AssertInExcept(name) => {
format!( format!(
"Found assertion on exception {name} in except block, use pytest.raises() \ "Found assertion on exception `{name}` in except block, use `pytest.raises()` \
instead" instead"
) )
} }
@ -3561,8 +3561,8 @@ impl CheckKind {
} }
CheckKind::FixtureParamWithoutValue(name) => { CheckKind::FixtureParamWithoutValue(name) => {
format!( format!(
"Fixture {name} without value is injected as parameter, use \ "Fixture `{name}` without value is injected as parameter, use \
@pytest.mark.usefixtures instead" `@pytest.mark.usefixtures` instead"
) )
} }
CheckKind::DeprecatedYieldFixture => { CheckKind::DeprecatedYieldFixture => {
@ -3572,7 +3572,7 @@ impl CheckKind {
"Use `yield` instead of `request.addfinalizer`".to_string() "Use `yield` instead of `request.addfinalizer`".to_string()
} }
CheckKind::UselessYieldFixture(name) => { CheckKind::UselessYieldFixture(name) => {
format!("No teardown in fixture {name}, use `return` instead of `yield`") format!("No teardown in fixture `{name}`, use `return` instead of `yield`")
} }
CheckKind::IncorrectMarkParenthesesStyle(mark_name, expected_parens, actual_parens) => { CheckKind::IncorrectMarkParenthesesStyle(mark_name, expected_parens, actual_parens) => {
format!( format!(