Skip to content

Commit 8eec42f

Browse files
authored
Merge pull request #6455 from blueyed/mypy-master
master: update mypy 0.740 -> 0.761
2 parents 3adaa3d + 090e260 commit 8eec42f

File tree

10 files changed

+15
-21
lines changed

10 files changed

+15
-21
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ repos:
3737
- id: pyupgrade
3838
args: [--py3-plus]
3939
- repo: https://github.com/pre-commit/mirrors-mypy
40-
rev: v0.740
40+
rev: v0.761
4141
hooks:
4242
- id: mypy
4343
files: ^(src/|testing/)

src/_pytest/_code/code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ def from_current(
479479
assert tup[1] is not None, "no current exception"
480480
assert tup[2] is not None, "no current exception"
481481
exc_info = (tup[0], tup[1], tup[2])
482-
return cls.from_exc_info(exc_info, exprinfo)
482+
return ExceptionInfo.from_exc_info(exc_info, exprinfo)
483483

484484
@classmethod
485485
def for_later(cls) -> "ExceptionInfo[_E]":

src/_pytest/assertion/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def pytest_addoption(parser):
3333
)
3434

3535

36-
def register_assert_rewrite(*names):
36+
def register_assert_rewrite(*names) -> None:
3737
"""Register one or more module names to be rewritten on import.
3838
3939
This function will make sure that this module or all modules inside

src/_pytest/assertion/rewrite.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,14 +1045,13 @@ def try_makedirs(cache_dir) -> bool:
10451045

10461046
def get_cache_dir(file_path: Path) -> Path:
10471047
"""Returns the cache directory to write .pyc files for the given .py file path"""
1048-
# Type ignored until added in next mypy release.
1049-
if sys.version_info >= (3, 8) and sys.pycache_prefix: # type: ignore
1048+
if sys.version_info >= (3, 8) and sys.pycache_prefix:
10501049
# given:
10511050
# prefix = '/tmp/pycs'
10521051
# path = '/home/user/proj/test_app.py'
10531052
# we want:
10541053
# '/tmp/pycs/home/user/proj'
1055-
return Path(sys.pycache_prefix) / Path(*file_path.parts[1:-1]) # type: ignore
1054+
return Path(sys.pycache_prefix) / Path(*file_path.parts[1:-1])
10561055
else:
10571056
# classic pycache directory
10581057
return file_path.parent / "__pycache__"

src/_pytest/compat.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343

4444

4545
if sys.version_info >= (3, 8):
46-
# Type ignored until next mypy release.
47-
from importlib import metadata as importlib_metadata # type: ignore
46+
from importlib import metadata as importlib_metadata
4847
else:
4948
import importlib_metadata # noqa: F401
5049

@@ -385,9 +384,7 @@ def overload(f): # noqa: F811
385384

386385

387386
if sys.version_info >= (3, 8):
388-
# TODO: Remove type ignore on next mypy update.
389-
# https://github.com/python/typeshed/commit/add0b5e930a1db16560fde45a3b710eefc625709
390-
from functools import cached_property # type: ignore
387+
from functools import cached_property
391388
else:
392389

393390
class cached_property(Generic[_S, _T]):

src/_pytest/doctest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,9 @@ def _find_lineno(self, obj, source_lines):
445445
obj = getattr(obj, "fget", obj)
446446
return doctest.DocTestFinder._find_lineno(self, obj, source_lines)
447447

448-
def _find(self, tests, obj, name, module, source_lines, globs, seen):
448+
def _find(
449+
self, tests, obj, name, module, source_lines, globs, seen
450+
) -> None:
449451
if _is_mocked(obj):
450452
return
451453
with _patch_unwrap_mock_aware():

src/_pytest/pytester.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ def inline_genitems(self, *args):
832832
items = [x.item for x in rec.getcalls("pytest_itemcollected")]
833833
return items, rec
834834

835-
def inline_run(self, *args, plugins=(), no_reraise_ctrlc=False):
835+
def inline_run(self, *args, plugins=(), no_reraise_ctrlc: bool = False):
836836
"""Run ``pytest.main()`` in-process, returning a HookRecorder.
837837
838838
Runs the :py:func:`pytest.main` function to run all of pytest inside

src/_pytest/reports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def __repr__(self):
259259
)
260260

261261
@classmethod
262-
def from_item_and_call(cls, item, call):
262+
def from_item_and_call(cls, item, call) -> "TestReport":
263263
"""
264264
Factory method to create and fill a TestReport with standard item and call info.
265265
"""

src/_pytest/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def pytest_runtest_makereport(item, call):
250250
return TestReport.from_item_and_call(item, call)
251251

252252

253-
def pytest_make_collect_report(collector):
253+
def pytest_make_collect_report(collector) -> CollectReport:
254254
call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
255255
longrepr = None
256256
if not call.excinfo:

testing/code/test_source.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,12 @@ def test_compile_and_getsource(self) -> None:
318318

319319
@pytest.mark.parametrize("name", ["", None, "my"])
320320
def test_compilefuncs_and_path_sanity(self, name: Optional[str]) -> None:
321-
def check(comp, name):
321+
def check(comp, name) -> None:
322322
co = comp(self.source, name)
323323
if not name:
324324
expected = "codegen %s:%d>" % (mypath, mylineno + 2 + 2) # type: ignore
325325
else:
326-
expected = "codegen %r %s:%d>" % (
327-
name,
328-
mypath, # type: ignore
329-
mylineno + 2 + 2, # type: ignore
330-
) # type: ignore
326+
expected = "codegen %r %s:%d>" % (name, mypath, mylineno + 2 + 2) # type: ignore
331327
fn = co.co_filename
332328
assert fn.endswith(expected)
333329

0 commit comments

Comments
 (0)