Skip to content

Commit 40e9abd

Browse files
[pre-commit.ci] pre-commit autoupdate (#11510)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/mirrors-mypy: v1.5.1 → v1.6.0](pre-commit/mirrors-mypy@v1.5.1...v1.6.0) * Ignore two typing errors after updating to mypy 1.6.0 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bruno Oliveira <[email protected]>
1 parent cac1eed commit 40e9abd

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ repos:
5656
hooks:
5757
- id: python-use-type-annotations
5858
- repo: https://github.com/pre-commit/mirrors-mypy
59-
rev: v1.5.1
59+
rev: v1.6.0
6060
hooks:
6161
- id: mypy
6262
files: ^(src/|testing/)

src/_pytest/_py/path.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,13 @@ def open(self, mode="r", ensure=False, encoding=None):
755755
if ensure:
756756
self.dirpath().ensure(dir=1)
757757
if encoding:
758-
return error.checked_call(io.open, self.strpath, mode, encoding=encoding)
758+
# Using type ignore here because of this error:
759+
# error: Argument 1 has incompatible type overloaded function;
760+
# expected "Callable[[str, Any, Any], TextIOWrapper]" [arg-type]
761+
# Which seems incorrect, given io.open supports the given argument types.
762+
return error.checked_call(
763+
io.open, self.strpath, mode, encoding=encoding # type:ignore[arg-type]
764+
)
759765
return error.checked_call(open, self.strpath, mode)
760766

761767
def _fastjoin(self, name):
@@ -1261,13 +1267,19 @@ def get_temproot(cls):
12611267
@classmethod
12621268
def mkdtemp(cls, rootdir=None):
12631269
"""Return a Path object pointing to a fresh new temporary directory
1264-
(which we created ourself).
1270+
(which we created ourselves).
12651271
"""
12661272
import tempfile
12671273

12681274
if rootdir is None:
12691275
rootdir = cls.get_temproot()
1270-
return cls(error.checked_call(tempfile.mkdtemp, dir=str(rootdir)))
1276+
# Using type ignore here because of this error:
1277+
# error: Argument 1 has incompatible type overloaded function; expected "Callable[[str], str]" [arg-type]
1278+
# Which seems incorrect, given tempfile.mkdtemp supports the given argument types.
1279+
path = error.checked_call(
1280+
tempfile.mkdtemp, dir=str(rootdir) # type:ignore[arg-type]
1281+
)
1282+
return cls(path)
12711283

12721284
@classmethod
12731285
def make_numbered_dir(

0 commit comments

Comments
 (0)