Skip to content
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

[flake8-pytest-style] Stabilize "Detect more pytest.mark.parametrize calls" (PT006) #15327

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

InSyncWithFoo
Copy link
Contributor

@InSyncWithFoo InSyncWithFoo commented Jan 7, 2025

Summary

Resolves #15324. Stabilizes the behavior changes introduced in #14515.

Test Plan

cargo nextest run and cargo insta test.

Copy link
Contributor

github-actions bot commented Jan 7, 2025

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+75 -21 violations, +0 -0 fixes in 8 projects; 47 projects unchanged)

apache/airflow (+57 -9 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

+ airflow/configuration.py:1313:17: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
- airflow/configuration.py:1313:17: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
+ airflow/utils/log/action_logger.py:22:5: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
- airflow/utils/log/action_logger.py:22:5: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
+ dev/breeze/src/airflow_breeze/utils/cdxgen.py:589:9: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
- dev/breeze/src/airflow_breeze/utils/cdxgen.py:589:9: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
+ dev/breeze/src/airflow_breeze/utils/reproducible.py:142:25: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
- dev/breeze/src/airflow_breeze/utils/reproducible.py:142:25: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
+ helm_tests/airflow_aux/test_annotations.py:249:5: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
+ providers/src/airflow/providers/elasticsearch/log/es_response.py:101:14: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
- providers/src/airflow/providers/elasticsearch/log/es_response.py:101:14: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
+ providers/src/airflow/providers/google/cloud/operators/dataproc_metastore.py:709:16: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
- providers/src/airflow/providers/google/cloud/operators/dataproc_metastore.py:709:16: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
... 7 additional changes omitted for rule FURB188
+ providers/tests/dbt/cloud/hooks/test_dbt.py:157:18: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
+ providers/tests/dbt/cloud/hooks/test_dbt.py:168:18: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
+ providers/tests/dbt/cloud/hooks/test_dbt.py:178:18: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
+ providers/tests/dbt/cloud/hooks/test_dbt.py:201:18: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
+ providers/tests/dbt/cloud/hooks/test_dbt.py:216:18: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
+ providers/tests/dbt/cloud/hooks/test_dbt.py:235:18: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
+ providers/tests/dbt/cloud/hooks/test_dbt.py:254:18: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
+ providers/tests/dbt/cloud/hooks/test_dbt.py:273:18: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
+ providers/tests/dbt/cloud/hooks/test_dbt.py:294:18: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
+ providers/tests/dbt/cloud/hooks/test_dbt.py:315:18: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
+ providers/tests/dbt/cloud/hooks/test_dbt.py:334:18: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
... 36 additional changes omitted for rule PT006
+ providers/tests/microsoft/azure/hooks/test_data_factory.py:157:13: PT007 Wrong values type in `pytest.mark.parametrize` expected `list` of `tuple`
... 41 additional changes omitted for project

bokeh/bokeh (+2 -2 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

+ src/bokeh/util/compiler.py:511:9: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
- src/bokeh/util/compiler.py:511:9: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
+ tests/support/plugins/file_server.py:63:9: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
- tests/support/plugins/file_server.py:63:9: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.

langchain-ai/langchain (+1 -1 violations, +0 -0 fixes)

+ libs/core/langchain_core/language_models/llms.py:352:9: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
- libs/core/langchain_core/language_models/llms.py:352:9: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.

latchbio/latch (+2 -2 violations, +0 -0 fixes)

+ src/latch_cli/snakemake/single_task_snakemake.py:365:12: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
- src/latch_cli/snakemake/single_task_snakemake.py:365:12: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
+ src/latch_cli/utils/__init__.py:106:5: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
- src/latch_cli/utils/__init__.py:106:5: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.

pypa/setuptools (+2 -0 violations, +0 -0 fixes)

+ pkg_resources/tests/test_working_set.py:107:9: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
+ setuptools/tests/test_egg_info.py:303:17: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`

reflex-dev/reflex (+1 -1 violations, +0 -0 fixes)

+ reflex/components/component.py:664:17: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
- reflex/components/component.py:664:17: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.

pdm-project/pdm (+4 -0 violations, +0 -0 fixes)

+ src/pdm/cli/commands/cache.py:37:47: FA100 Add `from __future__ import annotations` to simplify `typing.Iterable`
+ src/pdm/cli/commands/cache.py:97:20: FA100 Add `from __future__ import annotations` to simplify `typing.Iterable`
+ src/pdm/cli/commands/config.py:102:36: FA100 Add `from __future__ import annotations` to simplify `typing.Mapping`
+ src/pdm/cli/commands/config.py:102:67: FA100 Add `from __future__ import annotations` to simplify `typing.Mapping`

astropy/astropy (+6 -6 violations, +0 -0 fixes)

+ astropy/io/fits/hdu/compressed/_tiled_compression.py:259:5: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
- astropy/io/fits/hdu/compressed/_tiled_compression.py:259:5: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
+ astropy/io/fits/header.py:1646:9: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
- astropy/io/fits/header.py:1646:9: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
+ astropy/io/votable/converters.py:1056:13: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
- astropy/io/votable/converters.py:1056:13: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
+ astropy/io/votable/converters.py:1058:13: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
- astropy/io/votable/converters.py:1058:13: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
+ astropy/io/votable/converters.py:326:13: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
- astropy/io/votable/converters.py:326:13: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
... 2 additional changes omitted for project

Changes by rule (4 rules affected)

code total + violation - violation + fix - fix
PT006 49 49 0 0 0
FURB188 42 21 21 0 0
FA100 4 4 0 0 0
PT007 1 1 0 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+2553 -1620 violations, +4 -0 fixes in 31 projects; 24 projects unchanged)

RasaHQ/rasa (+1 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ tests/core/training/test_interactive.py:663:58: RUF025 [*] Unnecessary empty iterable within a deque call
- tests/core/training/test_interactive.py:663:58: RUF037 [*] Unnecessary empty iterable within a deque call

aiven/aiven-client (+409 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ aiven/client/argx.py:104:38: UP006 Use `collections.abc.Iterable` instead of `Iterable` for type annotation
+ aiven/client/argx.py:155:54: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ aiven/client/argx.py:171:45: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ aiven/client/argx.py:174:49: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ aiven/client/argx.py:241:29: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ aiven/client/argx.py:278:34: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ aiven/client/argx.py:278:44: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ aiven/client/argx.py:290:32: UP006 Use `collections.abc.Sequence` instead of `Sequence` for type annotation
+ aiven/client/argx.py:300:29: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ aiven/client/argx.py:303:34: UP006 Use `collections.abc.Sequence` instead of `Sequence` for type annotation
... 399 additional changes omitted for project

PlasmaPy/PlasmaPy (+0 -4 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

- tests/particles/test_decorators.py:437:5: B903 Class could be dataclass or namedtuple
- tests/particles/test_decorators.py:456:5: B903 Class could be dataclass or namedtuple
- tests/particles/test_decorators.py:494:5: B903 Class could be dataclass or namedtuple
- tests/particles/test_decorators_annotations.py:16:1: B903 Class could be dataclass or namedtuple

apache/airflow (+496 -20 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ airflow/api/auth/backend/deny_all.py:34:24: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ airflow/api_connexion/parameters.py:87:24: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ airflow/api_connexion/parameters.py:90:52: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ airflow/api_connexion/parameters.py:90:78: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ airflow/api_connexion/security.py:114:6: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ airflow/api_connexion/security.py:161:54: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
... 478 additional changes omitted for rule UP006
+ airflow/configuration.py:1313:17: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
- airflow/configuration.py:1313:17: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
+ airflow/utils/log/action_logger.py:22:5: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
- airflow/utils/log/action_logger.py:22:5: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
... 506 additional changes omitted for project

apache/superset (+246 -80 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ scripts/check-env.py:37:40: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ superset/advanced_data_type/types.py:58:21: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ superset/advanced_data_type/types.py:59:23: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ superset/async_events/async_query_manager.py:106:22: UP007 Use `X | Y` for type annotations
- superset/async_events/async_query_manager.py:106:22: UP045 Use `X | None` for type annotations
+ superset/async_events/async_query_manager.py:108:29: UP007 Use `X | Y` for type annotations
- superset/async_events/async_query_manager.py:108:29: UP045 Use `X | None` for type annotations
+ superset/async_events/async_query_manager.py:109:38: UP007 Use `X | Y` for type annotations
- superset/async_events/async_query_manager.py:109:38: UP045 Use `X | None` for type annotations
+ superset/async_events/async_query_manager.py:112:34: UP007 Use `X | Y` for type annotations
... 316 additional changes omitted for project

bokeh/bokeh (+252 -2 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ release/action.py:27:31: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ release/action.py:27:52: UP006 Use `collections.abc.Sequence` instead of `Sequence` for type annotation
+ release/action.py:35:47: UP006 Use `collections.abc.Sequence` instead of `Sequence` for type annotation
+ release/build.py:144:22: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ release/credentials.py:37:22: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ release/credentials.py:40:38: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
... 245 additional changes omitted for rule UP006
+ src/bokeh/util/compiler.py:511:9: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
- src/bokeh/util/compiler.py:511:9: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
+ tests/support/plugins/file_server.py:63:9: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
- tests/support/plugins/file_server.py:63:9: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
... 244 additional changes omitted for project

ibis-project/ibis (+3 -102 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

- ibis/backends/bigquery/__init__.py:847:48: UP045 [*] Use `X | None` for type annotations
- ibis/common/graph.py:171:46: UP045 [*] Use `X | None` for type annotations
- ibis/common/graph.py:203:50: UP045 [*] Use `X | None` for type annotations
- ibis/common/graph.py:275:41: UP045 [*] Use `X | None` for type annotations
- ibis/common/graph.py:310:47: UP045 [*] Use `X | None` for type annotations
- ibis/common/graph.py:359:47: UP045 [*] Use `X | None` for type annotations
... 97 additional changes omitted for rule UP045
+ ibis/common/tests/test_patterns.py:1122:13: UP006 [*] Use `collections.abc.Callable` instead of `Callable` for type annotation
+ ibis/common/tests/test_patterns.py:1125:10: UP006 [*] Use `collections.abc.Callable` instead of `Callable` for type annotation
+ ibis/common/tests/test_patterns.py:731:31: UP006 [*] Use `collections.abc.Callable` instead of `Callable` for type annotation
... 96 additional changes omitted for project

langchain-ai/langchain (+300 -1150 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ libs/core/langchain_core/_api/beta_decorator.py:128:35: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ libs/core/langchain_core/_api/beta_decorator.py:186:35: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ libs/core/langchain_core/_api/beta_decorator.py:201:35: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ libs/core/langchain_core/_api/beta_decorator.py:30:30: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ libs/core/langchain_core/_api/beta_decorator.py:39:6: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
+ libs/core/langchain_core/_api/deprecation.py:202:35: UP006 Use `collections.abc.Callable` instead of `Callable` for type annotation
... 294 additional changes omitted for rule UP006
- libs/core/langchain_core/caches.py:149:36: UP045 Use `X | None` for type annotations
- libs/core/langchain_core/caches.py:167:55: UP045 Use `X | None` for type annotations
- libs/core/langchain_core/caches.py:200:62: UP045 Use `X | None` for type annotations
- libs/core/langchain_core/caches.py:52:55: UP045 Use `X | None` for type annotations
- libs/core/langchain_core/caches.py:97:62: UP045 Use `X | None` for type annotations
- libs/core/langchain_core/callbacks/base.py:104:24: UP045 Use `X | None` for type annotations
... 1143 additional changes omitted for rule UP045
+ libs/core/langchain_core/language_models/llms.py:352:9: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
- libs/core/langchain_core/language_models/llms.py:352:9: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
- libs/core/tests/unit_tests/tracers/test_langchain.py:103:5: B903 Class could be dataclass or namedtuple
... 1435 additional changes omitted for project

latchbio/latch (+15 -15 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ src/latch/registry/record.py:188:57: UP007 Use `X | Y` for type annotations
- src/latch/registry/record.py:188:57: UP045 Use `X | None` for type annotations
+ src/latch/registry/record.py:190:64: UP007 Use `X | Y` for type annotations
- src/latch/registry/record.py:190:64: UP045 Use `X | None` for type annotations
+ src/latch/registry/record.py:215:53: UP007 Use `X | Y` for type annotations
- src/latch/registry/record.py:215:53: UP045 Use `X | None` for type annotations
+ src/latch/registry/record.py:217:60: UP007 Use `X | Y` for type annotations
- src/latch/registry/record.py:217:60: UP045 Use `X | None` for type annotations
+ src/latch/registry/record.py:250:10: UP007 Use `X | Y` for type annotations
- src/latch/registry/record.py:250:10: UP045 Use `X | None` for type annotations
... 20 additional changes omitted for project

... Truncated remaining completed project reports due to GitHub comment length restrictions

Changes by rule (12 rules affected)

code total + violation - violation + fix - fix
UP006 2431 2431 0 0 0
UP045 1552 0 1552 0 0
UP007 92 92 0 0 0
FURB188 42 21 21 0 0
B903 40 0 40 0 0
FA100 4 4 0 0 0
FURB171 4 0 0 4 0
RUF025 3 3 0 0 0
RUF037 3 0 3 0 0
PLR6301 2 1 1 0 0
CPY001 2 1 1 0 0
RUF100 2 0 2 0 0

@InSyncWithFoo InSyncWithFoo force-pushed the PT006 branch 3 times, most recently from 364f718 to 21227fc Compare January 7, 2025 20:16
@dylwil3
Copy link
Collaborator

dylwil3 commented Jan 7, 2025

I think this stabilization makes sense to me. But this PR may need to target the branch in #15238 , assuming @MichaReiser and @AlexWaygood agree

@MichaReiser MichaReiser self-assigned this Jan 8, 2025
@MichaReiser MichaReiser added the breaking Breaking API change label Jan 8, 2025
@MichaReiser MichaReiser changed the base branch from main to ruff-0.9 January 8, 2025 07:22
@MichaReiser MichaReiser changed the title [flake8-pytest-style] Detect keyword arguments in non-preview mode (PT006) [flake8-pytest-style] Stabilize "Detect more pytest.mark.parametrize calls (PT006) Jan 8, 2025
@MichaReiser MichaReiser added rule Implementing or modifying a lint rule and removed breaking Breaking API change labels Jan 8, 2025
Copy link

codspeed-hq bot commented Jan 8, 2025

CodSpeed Performance Report

Merging #15327 will improve performances by 4.62%

Comparing InSyncWithFoo:PT006 (af82bca) with ruff-0.9 (412084e)

Summary

⚡ 1 improvements
✅ 31 untouched benchmarks

Benchmarks breakdown

Benchmark ruff-0.9 InSyncWithFoo:PT006 Change
red_knot_check_file[cold] 88.1 ms 84.2 ms +4.62%

@InSyncWithFoo InSyncWithFoo changed the title [flake8-pytest-style] Stabilize "Detect more pytest.mark.parametrize calls (PT006) [flake8-pytest-style] Stabilize "Detect more pytest.mark.parametrize calls" (PT006) Jan 8, 2025
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@MichaReiser MichaReiser merged commit 49c4d12 into astral-sh:ruff-0.9 Jan 8, 2025
21 checks passed
@MichaReiser MichaReiser mentioned this pull request Jan 8, 2025
2 tasks
@InSyncWithFoo InSyncWithFoo deleted the PT006 branch January 8, 2025 08:35
MichaReiser pushed a commit that referenced this pull request Jan 8, 2025
…ze` calls" (`PT006`) (#15327)

Co-authored-by: Micha Reiser <[email protected]>
Resolves #15324. Stabilizes the behavior changes introduced in #14515.
MichaReiser pushed a commit that referenced this pull request Jan 8, 2025
…ze` calls" (`PT006`) (#15327)

Co-authored-by: Micha Reiser <[email protected]>
Resolves #15324. Stabilizes the behavior changes introduced in #14515.
MichaReiser pushed a commit that referenced this pull request Jan 9, 2025
…ze` calls" (`PT006`) (#15327)

Co-authored-by: Micha Reiser <[email protected]>
Resolves #15324. Stabilizes the behavior changes introduced in #14515.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PT006 issue not raised when keyword arguments are used instead of positional arguments.
3 participants