-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Change default for PT001 and PT023 #12838
Conversation
@@ -930,9 +925,7 @@ pub(crate) fn fixture( | |||
check_fixture_decorator(checker, name, decorator); | |||
} | |||
|
|||
if checker.enabled(Rule::PytestDeprecatedYieldFixture) | |||
&& checker.settings.flake8_pytest_style.fixture_parentheses |
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.
I think that was a bug. It's unclear to me why this rule would depend on enabling that setting.
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.
Yeah, that's odd. I tried digging through blame but the best I can conclude without spending too much time on it is that it's been this way for a long time xD
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
RET505 | 1582 | 0 | 0 | 1582 | 0 |
PT023 | 661 | 196 | 465 | 0 | 0 |
RET506 | 372 | 0 | 0 | 372 | 0 |
PT004 | 355 | 0 | 355 | 0 | 0 |
PT001 | 295 | 159 | 136 | 0 | 0 |
RET507 | 36 | 0 | 0 | 36 | 0 |
RET508 | 16 | 0 | 0 | 16 | 0 |
PT005 | 1 | 0 | 1 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+38 -356 violations, +0 -0 fixes in 5 projects; 49 projects unchanged)
apache/airflow (+0 -316 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
- helm_tests/airflow_aux/test_pod_template_file.py:48:9: PT004 Fixture `setup_test_cases` does not return anything, add leading underscore - kubernetes_tests/conftest.py:27:5: PT004 Fixture `initialize_providers_manager` does not return anything, add leading underscore - kubernetes_tests/test_base.py:58:9: PT004 Fixture `base_tests_setup` does not return anything, add leading underscore - kubernetes_tests/test_kubernetes_pod_operator.py:89:5: PT004 Fixture `mock_get_connection` does not return anything, add leading underscore - kubernetes_tests/test_kubernetes_pod_operator.py:98:9: PT004 Fixture `setup_tests` does not return anything, add leading underscore - tests/always/test_pandas.py:31:9: PT004 Fixture `setup_test_cases` does not return anything, add leading underscore - tests/always/test_pandas.py:48:9: PT004 Fixture `setup_test_cases` does not return anything, add leading underscore - tests/always/test_providers_manager.py:57:9: PT004 Fixture `inject_fixtures` does not return anything, add leading underscore - tests/api_connexion/conftest.py:64:5: PT004 Fixture `set_auto_role_public` does not return anything, add leading underscore - tests/api_connexion/endpoints/test_config_endpoint.py:238:9: PT004 Fixture `setup_attrs` does not return anything, add leading underscore - tests/api_connexion/endpoints/test_config_endpoint.py:70:9: PT004 Fixture `setup_attrs` does not return anything, add leading underscore - tests/api_connexion/endpoints/test_connection_endpoint.py:61:9: PT004 Fixture `setup_attrs` does not return anything, add leading underscore - tests/api_connexion/endpoints/test_dag_endpoint.py:122:9: PT004 Fixture `setup_attrs` does not return anything, add leading underscore - tests/api_connexion/endpoints/test_dag_parsing.py:67:9: PT004 Fixture `setup_attrs` does not return anything, add leading underscore - tests/api_connexion/endpoints/test_dag_run_endpoint.py:132:9: PT004 Fixture `setup_attrs` does not return anything, add leading underscore - tests/api_connexion/endpoints/test_dag_source_endpoint.py:74:9: PT004 Fixture `setup_attrs` does not return anything, add leading underscore - tests/api_connexion/endpoints/test_dag_stats_endpoint.py:62:9: PT004 Fixture `setup_attrs` does not return anything, add leading underscore - tests/api_connexion/endpoints/test_dag_warning_endpoint.py:67:9: PT004 Fixture `setup_attrs` does not return anything, add leading underscore - tests/api_connexion/endpoints/test_dataset_endpoint.py:655:9: PT004 Fixture `time_freezer` does not return anything, add leading underscore - tests/api_connexion/endpoints/test_dataset_endpoint.py:835:9: PT004 Fixture `time_freezer` does not return anything, add leading underscore - tests/api_connexion/endpoints/test_dataset_endpoint.py:84:9: PT004 Fixture `setup_attrs` does not return anything, add leading underscore ... 295 additional changes omitted for rule PT004 - tests/providers/ssh/operators/test_ssh.py:68:9: PT005 Fixture `_patch_exec_ssh_client` returns a value, remove leading underscore ... 294 additional changes omitted for project
apache/superset (+0 -40 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
- tests/integration_tests/celery_tests.py:71:5: PT004 Fixture `setup_sqllab` does not return anything, add leading underscore - tests/integration_tests/charts/api_tests.py:1274:9: PT004 Fixture `load_energy_charts` does not return anything, add leading underscore - tests/integration_tests/charts/api_tests.py:89:9: PT004 Fixture `clear_data_cache` does not return anything, add leading underscore - tests/integration_tests/charts/data/api_tests.py:93:5: PT004 Fixture `skip_by_backend` does not return anything, add leading underscore - tests/integration_tests/conftest.py:120:5: PT004 Fixture `setup_sample_data` does not return anything, add leading underscore - tests/integration_tests/core_tests.py:79:5: PT004 Fixture `cleanup` does not return anything, add leading underscore - tests/integration_tests/dashboards/filter_state/api_tests.py:57:5: PT004 Fixture `cache` does not return anything, add leading underscore - tests/integration_tests/explore/api_tests.py:66:5: PT004 Fixture `cache` does not return anything, add leading underscore - tests/integration_tests/explore/form_data/api_tests.py:68:5: PT004 Fixture `cache` does not return anything, add leading underscore - tests/integration_tests/fixtures/birth_names_dashboard.py:37:5: PT004 Fixture `load_birth_names_data` does not return anything, add leading underscore ... 30 additional changes omitted for project
freedomofpress/securedrop (+1 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ molecule/testinfra/ossec/test_journalist_mail.py:14:45: RUF100 [*] Unused `noqa` directive (non-enabled: `PT004`)
pandas-dev/pandas (+34 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ doc/source/user_guide/style.ipynb:cell 113:31:89: E501 Line too long (90 > 88) + doc/source/user_guide/style.ipynb:cell 113:33:89: E501 Line too long (98 > 88) + doc/source/user_guide/style.ipynb:cell 123:5:56: E741 Ambiguous variable name: `l` + doc/source/user_guide/style.ipynb:cell 125:2:13: C408 Unnecessary `dict` call (rewrite as a literal) + doc/source/user_guide/style.ipynb:cell 125:4:13: C408 Unnecessary `dict` call (rewrite as a literal) + doc/source/user_guide/style.ipynb:cell 125:6:13: C408 Unnecessary `dict` call (rewrite as a literal) + doc/source/user_guide/style.ipynb:cell 125:8:13: C408 Unnecessary `dict` call (rewrite as a literal) + doc/source/user_guide/style.ipynb:cell 126:1:1: NPY002 Replace legacy `np.random.seed` call with `np.random.Generator` + doc/source/user_guide/style.ipynb:cell 126:2:1: PLW0127 Self-assignment of variable `cmap` + doc/source/user_guide/style.ipynb:cell 126:2:8: PLW0128 Redeclared variable `cmap` in assignment ... 24 additional changes omitted for project
rotki/rotki (+3 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ rotkehlchen/tests/fixtures/globaldb.py:200:52: RUF100 [*] Unused `noqa` directive (non-enabled: `PT004`) + rotkehlchen/tests/fixtures/oracles.py:20:118: RUF100 [*] Unused `noqa` directive (non-enabled: `PT004`) + rotkehlchen/tests/fixtures/thegraph.py:12:67: RUF100 [*] Unused `noqa` directive (non-enabled: `PT004`)
Changes by rule (10 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PT004 | 355 | 0 | 355 | 0 | 0 |
E501 | 18 | 18 | 0 | 0 | 0 |
NPY002 | 8 | 8 | 0 | 0 | 0 |
RUF100 | 4 | 4 | 0 | 0 | 0 |
C408 | 4 | 4 | 0 | 0 | 0 |
E741 | 1 | 1 | 0 | 0 | 0 |
PLW0127 | 1 | 1 | 0 | 0 | 0 |
PLW0128 | 1 | 1 | 0 | 0 | 0 |
F811 | 1 | 1 | 0 | 0 | 0 |
PT005 | 1 | 0 | 1 | 0 | 0 |
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.
The big reduction in ecosystem hits is evidence that this is the way to go!
crates/ruff_linter/src/rules/flake8_pytest_style/rules/fixture.rs
Outdated
Show resolved
Hide resolved
@@ -930,9 +925,7 @@ pub(crate) fn fixture( | |||
check_fixture_decorator(checker, name, decorator); | |||
} | |||
|
|||
if checker.enabled(Rule::PytestDeprecatedYieldFixture) | |||
&& checker.settings.flake8_pytest_style.fixture_parentheses |
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.
Yeah, that's odd. I tried digging through blame but the best I can conclude without spending too much time on it is that it's been this way for a long time xD
Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
The documentation string was updated, but not the examples. Fix in: #13019 |
Summary
This PR promotes the changed defaults for PT001 and PT023 to not require parentheses for fixtures and marker decorators without arguments to stable.
The default were changed in preview mode back in June (#12106).
See #8796
Test Plan
Updated snapshot tests