[flake8-pytest-style] Don't recommend usefixtures for parametrize values in PT019#17650
[flake8-pytest-style] Don't recommend usefixtures for parametrize values in PT019#17650ntBre merged 7 commits intoastral-sh:mainfrom
flake8-pytest-style] Don't recommend usefixtures for parametrize values in PT019#17650Conversation
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PT019 | 4 | 0 | 4 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+0 -4 violations, +0 -0 fixes in 1 projects; 54 projects unchanged)
apache/airflow (+0 -4 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
- airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_task_instances.py:944:89: PT019 Fixture `_json` without value is injected as parameter, use `@pytest.mark.usefixtures` instead - providers/fab/tests/unit/fab/www/views/test_views_custom_user_views.py:102:71: PT019 Fixture `_` without value is injected as parameter, use `@pytest.mark.usefixtures` instead - providers/google/tests/unit/google/common/test_deprecated.py:155:61: PT019 Fixture `_str` without value is injected as parameter, use `@pytest.mark.usefixtures` instead - providers/standard/tests/unit/standard/operators/test_weekday.py:297:57: PT019 Fixture `_` without value is injected as parameter, use `@pytest.mark.usefixtures` instead
Changes by rule (1 rules affected)
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PT019 | 4 | 0 | 4 | 0 | 0 |
flake8_pytest_style] Don't recommend usefixtures for parametrize valuesflake8_pytest_style] Don't recommend usefixtures for parametrize values in PT019
ntBre
left a comment
There was a problem hiding this comment.
Thanks!
The logic here looks good. I made a couple of stylistic suggestions and also noted a couple of additional cases we may need to handle for parameterize argument types.
crates/ruff_linter/src/rules/flake8_pytest_style/rules/helpers.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/flake8_pytest_style/rules/fixture.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/flake8_pytest_style/rules/fixture.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/flake8_pytest_style/rules/fixture.rs
Outdated
Show resolved
Hide resolved
Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
crates/ruff_linter/src/rules/flake8_pytest_style/rules/fixture.rs
Outdated
Show resolved
Hide resolved
flake8_pytest_style] Don't recommend usefixtures for parametrize values in PT019flake8-pytest-style] Don't recommend usefixtures for parametrize values in PT019
ntBre
left a comment
There was a problem hiding this comment.
Thanks! Just a couple small nits and a question. It might also be good to throw in a test for a string where trimming whitespace matters. If we add special handling for Expr::Name, that might deserve a test too.
crates/ruff_linter/src/rules/flake8_pytest_style/rules/fixture.rs
Outdated
Show resolved
Hide resolved
ntBre
left a comment
There was a problem hiding this comment.
Thanks, just one clarification on the test I was picturing before.
crates/ruff_linter/resources/test/fixtures/flake8_pytest_style/PT019.py
Outdated
Show resolved
Hide resolved
… values in `PT019` (astral-sh#17650) <!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary Fixes astral-sh#17599. ## Test Plan Snapshot tests. --------- Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
Summary
Fixes #17599.
Test Plan
Snapshot tests.