Skip to content

Commit e34fc62

Browse files
[pre-commit.ci] pre-commit autoupdate (#13306)
updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.10 → v0.11.0](astral-sh/ruff-pre-commit@v0.9.10...v0.11.0) - [github.com/woodruffw/zizmor-pre-commit: v1.4.1 → v1.5.1](woodruffw/zizmor-pre-commit@v1.4.1...v1.5.1) * [lint] Put noqa in pyproject.toml or locally if possible Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
1 parent 2b40981 commit e34fc62

File tree

5 files changed

+18
-21
lines changed

5 files changed

+18
-21
lines changed

.pre-commit-config.yaml

+2-2
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.9.10"
3+
rev: "v0.11.0"
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/woodruffw/zizmor-pre-commit
15-
rev: v1.4.1
15+
rev: v1.5.1
1616
hooks:
1717
- id: zizmor
1818
- repo: https://github.com/adamchainz/blacken-docs

pyproject.toml

+4
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ lint.per-file-ignores."src/_pytest/_py/**/*.py" = [
167167
lint.per-file-ignores."src/_pytest/_version.py" = [
168168
"I001",
169169
]
170+
# can't be disabled on a line-by-line basis in file
171+
lint.per-file-ignores."testing/code/test_source.py" = [
172+
"F841",
173+
]
170174
lint.per-file-ignores."testing/python/approx.py" = [
171175
"B015",
172176
]

src/_pytest/raises_group.py

+7-11
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,9 @@ def _check_raw_type(
119119
def is_fully_escaped(s: str) -> bool:
120120
# we know we won't compile with re.VERBOSE, so whitespace doesn't need to be escaped
121121
metacharacters = "{}()+.*?^$[]"
122-
123-
for i, c in enumerate(s):
124-
if c in metacharacters and (i == 0 or s[i - 1] != "\\"):
125-
return False
126-
127-
return True
122+
return not any(
123+
c in metacharacters and (i == 0 or s[i - 1] != "\\") for (i, c) in enumerate(s)
124+
)
128125

129126

130127
def unescape(s: str) -> str:
@@ -1198,8 +1195,7 @@ def possible_match(results: ResultHolder, used: set[int] | None = None) -> bool:
11981195
curr_row = len(used)
11991196
if curr_row == len(results.results):
12001197
return True
1201-
1202-
for i, val in enumerate(results.results[curr_row]):
1203-
if val is None and i not in used and possible_match(results, used | {i}):
1204-
return True
1205-
return False
1198+
return any(
1199+
val is None and i not in used and possible_match(results, used | {i})
1200+
for (i, val) in enumerate(results.results[curr_row])
1201+
)

testing/_py/test_local.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def test_visit_filterfunc_is_string(self, path1, fil):
215215
lst = []
216216
for i in path1.visit(fil):
217217
lst.append(i.relto(path1))
218-
assert len(lst), 2
218+
assert len(lst), 2 # noqa: PLC1802,RUF040
219219
assert "sampledir" in lst
220220
assert "otherdir" in lst
221221

testing/code/test_source.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
# mypy: allow-untyped-defs
2-
# flake8: noqa
3-
# disable flake check on this file because some constructs are strange
4-
# or redundant on purpose and can't be disable on a line-by-line basis
2+
from __future__ import annotations
3+
54
import inspect
65
import linecache
6+
from pathlib import Path
77
import sys
88
import textwrap
9-
from pathlib import Path
109
from typing import Any
11-
from typing import Dict
1210

13-
import pytest
1411
from _pytest._code import Code
1512
from _pytest._code import Frame
1613
from _pytest._code import getfslineno
1714
from _pytest._code import Source
1815
from _pytest.pathlib import import_path
16+
import pytest
1917

2018

2119
def test_source_str_function() -> None:
@@ -464,7 +462,6 @@ def test_comment_in_statement() -> None:
464462

465463
def test_source_with_decorator() -> None:
466464
"""Test behavior with Source / Code().source with regard to decorators."""
467-
from _pytest.compat import get_real_func
468465

469466
@pytest.mark.foo
470467
def deco_mark():

0 commit comments

Comments
 (0)