Skip to content

Commit 1b23a11

Browse files
committed
Update mypy 0.782 -> 0.790
1 parent e5e47c1 commit 1b23a11

13 files changed

+20
-24
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ repos:
4949
hooks:
5050
- id: python-use-type-annotations
5151
- repo: https://github.com/pre-commit/mirrors-mypy
52-
rev: v0.782 # NOTE: keep this in sync with setup.cfg.
52+
rev: v0.790 # NOTE: keep this in sync with setup.cfg.
5353
hooks:
5454
- id: mypy
5555
files: ^(src/|testing/)

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ console_scripts =
6363

6464
[options.extras_require]
6565
checkqa-mypy =
66-
mypy==0.780
66+
mypy==0.790
6767
testing =
6868
argcomplete
6969
hypothesis>=3.56

src/_pytest/cacheprovider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ def pytest_collection_modifyitems(
382382
self.cached_nodeids.update(item.nodeid for item in items)
383383

384384
def _get_increasing_order(self, items: Iterable[nodes.Item]) -> List[nodes.Item]:
385-
return sorted(items, key=lambda item: item.fspath.mtime(), reverse=True)
385+
return sorted(items, key=lambda item: item.fspath.mtime(), reverse=True) # type: ignore[no-any-return]
386386

387387
def pytest_sessionfinish(self) -> None:
388388
config = self.config

src/_pytest/capture.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,7 @@ def __init__(self, targetfd: int) -> None:
380380
self.syscapture = SysCapture(targetfd)
381381
else:
382382
self.tmpfile = EncodedFile(
383-
# TODO: Remove type ignore, fixed in next mypy release.
384-
TemporaryFile(buffering=0), # type: ignore[arg-type]
383+
TemporaryFile(buffering=0),
385384
encoding="utf-8",
386385
errors="replace",
387386
newline="",

src/_pytest/compat.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,8 @@ def getfuncargnames(
150150
p.name
151151
for p in parameters.values()
152152
if (
153-
# TODO: Remove type ignore after https://github.com/python/typeshed/pull/4383
154-
p.kind is Parameter.POSITIONAL_OR_KEYWORD # type: ignore[unreachable]
155-
or p.kind is Parameter.KEYWORD_ONLY # type: ignore[unreachable]
153+
p.kind is Parameter.POSITIONAL_OR_KEYWORD
154+
or p.kind is Parameter.KEYWORD_ONLY
156155
)
157156
and p.default is Parameter.empty
158157
)

src/_pytest/pytester.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,8 +1322,10 @@ def run(
13221322
"""
13231323
__tracebackhide__ = True
13241324

1325+
# TODO: Remove type ignore in next mypy release.
1326+
# https://github.com/python/typeshed/pull/4582
13251327
cmdargs = tuple(
1326-
os.fspath(arg) if isinstance(arg, os.PathLike) else arg for arg in cmdargs
1328+
os.fspath(arg) if isinstance(arg, os.PathLike) else arg for arg in cmdargs # type: ignore[misc]
13271329
)
13281330
p1 = self.path.joinpath("stdout")
13291331
p2 = self.path.joinpath("stderr")

src/_pytest/python_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def __repr__(self) -> str:
210210
# tolerances, i.e. non-numerics and infinities. Need to call abs to
211211
# handle complex numbers, e.g. (inf + 1j).
212212
if (not isinstance(self.expected, (Complex, Decimal))) or math.isinf(
213-
abs(self.expected)
213+
abs(self.expected) # type: ignore[arg-type]
214214
):
215215
return str(self.expected)
216216

@@ -253,16 +253,16 @@ def __eq__(self, actual) -> bool:
253253
# Allow the user to control whether NaNs are considered equal to each
254254
# other or not. The abs() calls are for compatibility with complex
255255
# numbers.
256-
if math.isnan(abs(self.expected)):
257-
return self.nan_ok and math.isnan(abs(actual))
256+
if math.isnan(abs(self.expected)): # type: ignore[arg-type]
257+
return self.nan_ok and math.isnan(abs(actual)) # type: ignore[arg-type]
258258

259259
# Infinity shouldn't be approximately equal to anything but itself, but
260260
# if there's a relative tolerance, it will be infinite and infinity
261261
# will seem approximately equal to everything. The equal-to-itself
262262
# case would have been short circuited above, so here we can just
263263
# return false if the expected value is infinite. The abs() call is
264264
# for compatibility with complex numbers.
265-
if math.isinf(abs(self.expected)):
265+
if math.isinf(abs(self.expected)): # type: ignore[arg-type]
266266
return False
267267

268268
# Return true if the two numbers are within the tolerance.

src/_pytest/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def pytest_terminal_summary(terminalreporter: "TerminalReporter") -> None:
7777
dlist.append(rep)
7878
if not dlist:
7979
return
80-
dlist.sort(key=lambda x: x.duration)
80+
dlist.sort(key=lambda x: x.duration) # type: ignore[no-any-return]
8181
dlist.reverse()
8282
if not durations:
8383
tr.write_sep("=", "slowest durations")

testing/test_assertrewrite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1595,7 +1595,7 @@ def test_get_cache_dir(self, monkeypatch, prefix, source, expected):
15951595
if prefix:
15961596
if sys.version_info < (3, 8):
15971597
pytest.skip("pycache_prefix not available in py<38")
1598-
monkeypatch.setattr(sys, "pycache_prefix", prefix) # type:ignore
1598+
monkeypatch.setattr(sys, "pycache_prefix", prefix)
15991599

16001600
assert get_cache_dir(Path(source)) == Path(expected)
16011601

testing/test_capture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,7 @@ def test_stderr_write_returns_len(capsys):
16061606
def test_encodedfile_writelines(tmpfile: BinaryIO) -> None:
16071607
ef = capture.EncodedFile(tmpfile, encoding="utf-8")
16081608
with pytest.raises(TypeError):
1609-
ef.writelines([b"line1", b"line2"])
1609+
ef.writelines([b"line1", b"line2"]) # type: ignore[list-item]
16101610
assert ef.writelines(["line3", "line4"]) is None # type: ignore[func-returns-value]
16111611
ef.flush()
16121612
tmpfile.seek(0)

0 commit comments

Comments
 (0)