Skip to content

Commit 66b2891

Browse files
authored
Merge pull request #10497 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2 parents cca029d + d5466b3 commit 66b2891

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ repos:
4444
- id: reorder-python-imports
4545
args: ['--application-directories=.:src', --py37-plus]
4646
- repo: https://github.com/asottile/pyupgrade
47-
rev: v3.2.0
47+
rev: v3.2.2
4848
hooks:
4949
- id: pyupgrade
5050
args: [--py37-plus]
@@ -58,7 +58,7 @@ repos:
5858
hooks:
5959
- id: python-use-type-annotations
6060
- repo: https://github.com/pre-commit/mirrors-mypy
61-
rev: v0.982
61+
rev: v0.990
6262
hooks:
6363
- id: mypy
6464
files: ^(src/|testing/)

src/_pytest/_py/path.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from stat import S_ISREG
2525
from typing import Any
2626
from typing import Callable
27+
from typing import cast
2728
from typing import overload
2829
from typing import TYPE_CHECKING
2930

@@ -146,7 +147,7 @@ def __init__(self, fil, rec, ignore, bf, sort):
146147
self.fil = fil
147148
self.ignore = ignore
148149
self.breadthfirst = bf
149-
self.optsort = sort and sorted or (lambda x: x)
150+
self.optsort = cast(Callable[[Any], Any], sorted) if sort else (lambda x: x)
150151

151152
def gen(self, path):
152153
try:
@@ -224,7 +225,7 @@ def owner(self):
224225
raise NotImplementedError("XXX win32")
225226
import pwd
226227

227-
entry = error.checked_call(pwd.getpwuid, self.uid)
228+
entry = error.checked_call(pwd.getpwuid, self.uid) # type:ignore[attr-defined]
228229
return entry[0]
229230

230231
@property
@@ -234,7 +235,7 @@ def group(self):
234235
raise NotImplementedError("XXX win32")
235236
import grp
236237

237-
entry = error.checked_call(grp.getgrgid, self.gid)
238+
entry = error.checked_call(grp.getgrgid, self.gid) # type:ignore[attr-defined]
238239
return entry[0]
239240

240241
def isdir(self):
@@ -252,15 +253,15 @@ def getuserid(user):
252253
import pwd
253254

254255
if not isinstance(user, int):
255-
user = pwd.getpwnam(user)[2]
256+
user = pwd.getpwnam(user)[2] # type:ignore[attr-defined]
256257
return user
257258

258259

259260
def getgroupid(group):
260261
import grp
261262

262263
if not isinstance(group, int):
263-
group = grp.getgrnam(group)[2]
264+
group = grp.getgrnam(group)[2] # type:ignore[attr-defined]
264265
return group
265266

266267

src/_pytest/hookspec.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ def pytest_assertion_pass(item: "Item", lineno: int, orig: str, expl: str) -> No
738738
# -------------------------------------------------------------------------
739739

740740

741-
def pytest_report_header(
741+
def pytest_report_header( # type:ignore[empty-body]
742742
config: "Config", start_path: Path, startdir: "LEGACY_PATH"
743743
) -> Union[str, List[str]]:
744744
"""Return a string or list of strings to be displayed as header info for terminal reporting.
@@ -767,7 +767,7 @@ def pytest_report_header(
767767
"""
768768

769769

770-
def pytest_report_collectionfinish(
770+
def pytest_report_collectionfinish( # type:ignore[empty-body]
771771
config: "Config",
772772
start_path: Path,
773773
startdir: "LEGACY_PATH",
@@ -800,7 +800,7 @@ def pytest_report_collectionfinish(
800800

801801

802802
@hookspec(firstresult=True)
803-
def pytest_report_teststatus(
803+
def pytest_report_teststatus( # type:ignore[empty-body]
804804
report: Union["CollectReport", "TestReport"], config: "Config"
805805
) -> Tuple[str, str, Union[str, Mapping[str, bool]]]:
806806
"""Return result-category, shortletter and verbose word for status
@@ -880,7 +880,9 @@ def pytest_warning_recorded(
880880
# -------------------------------------------------------------------------
881881

882882

883-
def pytest_markeval_namespace(config: "Config") -> Dict[str, Any]:
883+
def pytest_markeval_namespace( # type:ignore[empty-body]
884+
config: "Config",
885+
) -> Dict[str, Any]:
884886
"""Called when constructing the globals dictionary used for
885887
evaluating string conditions in xfail/skipif markers.
886888

testing/_py/test_local.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ def test_long_filenames(self, tmpdir):
803803
# depending on how the paths are used), but > 4096 (which is the
804804
# Linux' limitation) - the behaviour of paths with names > 4096 chars
805805
# is undetermined
806-
newfilename = "/test" * 60
806+
newfilename = "/test" * 60 # type:ignore[unreachable]
807807
l1 = tmpdir.join(newfilename)
808808
l1.ensure(file=True)
809809
l1.write("foo")
@@ -1344,8 +1344,8 @@ def test_realpath_file(self, tmpdir):
13441344
assert realpath.basename == "file"
13451345

13461346
def test_owner(self, path1, tmpdir):
1347-
from pwd import getpwuid
1348-
from grp import getgrgid
1347+
from pwd import getpwuid # type:ignore[attr-defined]
1348+
from grp import getgrgid # type:ignore[attr-defined]
13491349

13501350
stat = path1.stat()
13511351
assert stat.path == path1

testing/test_monkeypatch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_delattr(self, monkeypatch: MonkeyPatch) -> None:
9292
mp.delattr("os.path.abspath")
9393
assert not hasattr(os.path, "abspath")
9494
mp.undo()
95-
assert os.path.abspath
95+
assert os.path.abspath # type:ignore[truthy-function]
9696

9797

9898
def test_delattr() -> None:

0 commit comments

Comments
 (0)