-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[flake8-pytest-style
] Don't recommend usefixtures
for parametrize values in PT019
#17650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 PT019
flake8-pytest-style
] Don't recommend usefixtures
for parametrize values in PT019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Summary
Fixes #17599.
Test Plan
Snapshot tests.