Skip to content

Commit 9f9dabd

Browse files
Merge pull request #12910 [pre-commit.ci] pre-commit autoupdate
2 parents c85faf0 + 607b9f7 commit 9f9dabd

File tree

6 files changed

+49
-18
lines changed

6 files changed

+49
-18
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: "v0.6.9"
3+
rev: "v0.7.2"
44
hooks:
55
- id: ruff
66
args: ["--fix"]
@@ -12,7 +12,7 @@ repos:
1212
- id: end-of-file-fixer
1313
- id: check-yaml
1414
- repo: https://github.com/adamchainz/blacken-docs
15-
rev: 1.19.0
15+
rev: 1.19.1
1616
hooks:
1717
- id: blacken-docs
1818
additional_dependencies: [black==24.1.1]
@@ -28,7 +28,7 @@ repos:
2828
hooks:
2929
- id: python-use-type-annotations
3030
- repo: https://github.com/pre-commit/mirrors-mypy
31-
rev: v1.11.2
31+
rev: v1.13.0
3232
hooks:
3333
- id: mypy
3434
files: ^(src/|testing/|scripts/)
@@ -44,13 +44,13 @@ repos:
4444
# on <3.11
4545
- exceptiongroup>=1.0.0rc8
4646
- repo: https://github.com/tox-dev/pyproject-fmt
47-
rev: "2.3.1"
47+
rev: "v2.5.0"
4848
hooks:
4949
- id: pyproject-fmt
5050
# https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version
5151
additional_dependencies: ["tox>=4.9"]
5252
- repo: https://github.com/asottile/pyupgrade
53-
rev: v3.18.0
53+
rev: v3.19.0
5454
hooks:
5555
- id: pyupgrade
5656
stages: [manual]
@@ -61,7 +61,8 @@ repos:
6161
entry: pylint
6262
language: system
6363
types: [python]
64-
args: ["-rn", "-sn", "--fail-on=I"]
64+
args: ["-rn", "-sn", "--fail-on=I", "--enable-all-extentions"]
65+
require_serial: true
6566
stages: [manual]
6667
- id: rst
6768
name: rst

pyproject.toml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ dependencies = [
5151
"exceptiongroup>=1.0.0rc8; python_version<'3.11'",
5252
"iniconfig",
5353
"packaging",
54-
"pluggy<2,>=1.5",
54+
"pluggy>=1.5,<2",
5555
"tomli>=1; python_version<'3.11'",
5656
]
5757
optional-dependencies.dev = [
@@ -200,7 +200,9 @@ disable = [
200200
"arguments-renamed",
201201
"assigning-non-slot",
202202
"attribute-defined-outside-init",
203+
"bad-builtin",
203204
"bad-classmethod-argument",
205+
"bad-dunder-name",
204206
"bad-mcs-method-argument",
205207
"broad-exception-caught",
206208
"broad-exception-raised",
@@ -209,25 +211,40 @@ disable = [
209211
"comparison-with-callable",
210212
"comparison-with-itself", # PLR0124 from ruff
211213
"condition-evals-to-constant",
214+
"consider-alternative-union-syntax",
215+
"confusing-consecutive-elif",
216+
"consider-using-any-or-all",
217+
"consider-using-assignment-expr",
212218
"consider-using-dict-items",
213219
"consider-using-from-import",
214220
"consider-using-f-string",
215221
"consider-using-in",
222+
"consider-using-namedtuple-or-dataclass",
216223
"consider-using-ternary",
224+
"consider-using-tuple",
217225
"consider-using-with",
218226
"consider-using-from-import", # not activated by default, PLR0402 disabled in ruff
227+
"consider-ternary-expression",
219228
"cyclic-import",
229+
"differing-param-doc",
230+
"docstring-first-line-empty",
231+
"deprecated-argument",
232+
"deprecated-attribute",
233+
"deprecated-class",
234+
"deprecated-typing-alias",
220235
"disallowed-name", # foo / bar are used often in tests
221236
"duplicate-code",
222237
"else-if-used", # not activated by default, PLR5501 disabled in ruff
223238
"empty-comment", # not activated by default, PLR2044 disabled in ruff
224239
"eval-used",
240+
"eq-without-hash",
225241
"exec-used",
226242
"expression-not-assigned",
227243
"fixme",
228244
"global-statement", # PLW0603 disabled in ruff
229245
"import-error",
230246
"import-outside-toplevel",
247+
"import-private-name",
231248
"inconsistent-return-statements",
232249
"invalid-bool-returned",
233250
"invalid-name",
@@ -238,8 +255,12 @@ disable = [
238255
"magic-value-comparison", # not activated by default, PLR2004 disabled in ruff
239256
"method-hidden",
240257
"missing-docstring",
258+
"missing-param-doc",
259+
"missing-raises-doc",
241260
"missing-timeout",
261+
"missing-type-doc",
242262
"misplaced-bare-raise", # PLE0704 from ruff
263+
"misplaced-comparison-constant",
243264
"multiple-statements", # multiple-statements-on-one-line-colon (E701) from ruff
244265
"no-else-break",
245266
"no-else-continue",
@@ -248,6 +269,7 @@ disable = [
248269
"no-member",
249270
"no-name-in-module",
250271
"no-self-argument",
272+
"no-self-use",
251273
"not-an-iterable",
252274
"not-callable",
253275
"pointless-exception-statement", # https://github.com/pytest-dev/pytest/pull/12379
@@ -260,12 +282,14 @@ disable = [
260282
"redefined-builtin",
261283
"redefined-loop-name", # PLW2901 disabled in ruff
262284
"redefined-outer-name",
285+
"redefined-variable-type",
263286
"reimported",
264287
"simplifiable-condition",
265288
"simplifiable-if-expression",
266289
"singleton-comparison",
267290
"superfluous-parens",
268291
"super-init-not-called",
292+
"too-complex",
269293
"too-few-public-methods",
270294
"too-many-ancestors",
271295
"too-many-arguments", # disabled in ruff
@@ -275,9 +299,11 @@ disable = [
275299
"too-many-lines",
276300
"too-many-locals",
277301
"too-many-nested-blocks",
302+
"too-many-positional-arguments",
278303
"too-many-public-methods",
279304
"too-many-return-statements", # disabled in ruff
280305
"too-many-statements", # disabled in ruff
306+
"too-many-try-statements",
281307
"try-except-raise",
282308
"typevar-name-incorrect-variance", # PLC0105 disabled in ruff
283309
"unbalanced-tuple-unpacking",
@@ -299,10 +325,12 @@ disable = [
299325
"use-dict-literal",
300326
"use-implicit-booleaness-not-comparison",
301327
"use-implicit-booleaness-not-len",
328+
"use-set-for-membership",
302329
"useless-else-on-loop", # PLC0414 disabled in ruff
303330
"useless-import-alias",
304331
"useless-return",
305332
"using-constant-test",
333+
"while-used",
306334
"wrong-import-order", # handled by isort / ruff
307335
"wrong-import-position", # handled by isort / ruff
308336
]

src/_pytest/_io/pprint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ def _format(
111111
p(self, object, stream, indent, allowance, context, level + 1)
112112
context.remove(objid)
113113
elif (
114-
_dataclasses.is_dataclass(object) # type:ignore[unreachable]
114+
_dataclasses.is_dataclass(object)
115115
and not isinstance(object, type)
116-
and object.__dataclass_params__.repr
116+
and object.__dataclass_params__.repr # type:ignore[attr-defined]
117117
and
118118
# Check dataclass has generated repr method.
119119
hasattr(object.__repr__, "__wrapped__")
120120
and "__create_fn__" in object.__repr__.__wrapped__.__qualname__
121121
):
122-
context.add(objid) # type:ignore[unreachable]
122+
context.add(objid)
123123
self._pprint_dataclass(
124124
object, stream, indent, allowance, context, level + 1
125125
)

src/_pytest/capture.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from typing import Any
1616
from typing import AnyStr
1717
from typing import BinaryIO
18+
from typing import cast
1819
from typing import Final
1920
from typing import final
2021
from typing import Generator
@@ -177,7 +178,8 @@ def name(self) -> str:
177178
def mode(self) -> str:
178179
# TextIOWrapper doesn't expose a mode, but at least some of our
179180
# tests check it.
180-
return self.buffer.mode.replace("b", "")
181+
assert hasattr(self.buffer, "mode")
182+
return cast(str, self.buffer.mode.replace("b", ""))
181183

182184

183185
class CaptureIO(io.TextIOWrapper):
@@ -550,7 +552,7 @@ def snap(self) -> bytes:
550552
res = self.tmpfile.buffer.read()
551553
self.tmpfile.seek(0)
552554
self.tmpfile.truncate()
553-
return res
555+
return res # type: ignore[return-value]
554556

555557
def writeorg(self, data: bytes) -> None:
556558
"""Write to original file descriptor."""

src/_pytest/junitxml.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ def merge_family(left, right) -> None:
7474
left.update(result)
7575

7676

77-
families = {}
78-
families["_base"] = {"testcase": ["classname", "name"]}
79-
families["_base_legacy"] = {"testcase": ["file", "line", "url"]}
80-
77+
families = { # pylint: disable=dict-init-mutate
78+
"_base": {"testcase": ["classname", "name"]},
79+
"_base_legacy": {"testcase": ["file", "line", "url"]},
80+
}
8181
# xUnit 1.x inherits legacy attributes.
8282
families["xunit1"] = families["_base"].copy()
8383
merge_family(families["xunit1"], families["_base_legacy"])

testing/test_runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ def raiser(exc):
137137
ss.teardown_exact(None)
138138
mod, func = e.value.exceptions
139139
assert isinstance(mod, KeyError)
140-
assert isinstance(func.exceptions[0], TypeError) # type: ignore
141-
assert isinstance(func.exceptions[1], ValueError) # type: ignore
140+
assert isinstance(func.exceptions[0], TypeError)
141+
assert isinstance(func.exceptions[1], ValueError)
142142

143143
def test_cached_exception_doesnt_get_longer(self, pytester: Pytester) -> None:
144144
"""Regression test for #12204 (the "BTW" case)."""

0 commit comments

Comments
 (0)