diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1fd3e3827..8c47b5576 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,7 @@ repos: - id: pyupgrade args: [--py3-plus] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.761 # NOTE: keep this in sync with setup.py. + rev: v0.770 # NOTE: keep this in sync with setup.py. hooks: - id: mypy files: ^(src/|testing/) diff --git a/setup.py b/setup.py index 892b55aed..6ebfd67fb 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ def main(): "xmlschema", ], "checkqa-mypy": [ - "mypy==v0.761", # keep this in sync with .pre-commit-config.yaml. + "mypy==v0.770", # keep this in sync with .pre-commit-config.yaml. ], }, install_requires=INSTALL_REQUIRES, diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index df97181f4..7f52778b9 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -678,7 +678,7 @@ def raises( # noqa: F811 """ __tracebackhide__ = True for exc in filterfalse( - inspect.isclass, always_iterable(expected_exception, BASE_TYPE) # type: ignore[arg-type] # noqa: F821 + inspect.isclass, always_iterable(expected_exception, BASE_TYPE) ): msg = "exceptions must be derived from BaseException, not %s" raise TypeError(msg % type(exc)) diff --git a/src/_pytest/recwarn.py b/src/_pytest/recwarn.py index c57c94b1c..58b6fbab9 100644 --- a/src/_pytest/recwarn.py +++ b/src/_pytest/recwarn.py @@ -139,18 +139,18 @@ class WarningsRecorder(warnings.catch_warnings): def __init__(self): super().__init__(record=True) self._entered = False - self._list = [] # type: List[warnings._Record] + self._list = [] # type: List[warnings.WarningMessage] @property - def list(self) -> List["warnings._Record"]: + def list(self) -> List["warnings.WarningMessage"]: """The list of recorded warnings.""" return self._list - def __getitem__(self, i: int) -> "warnings._Record": + def __getitem__(self, i: int) -> "warnings.WarningMessage": """Get a recorded warning by index.""" return self._list[i] - def __iter__(self) -> Iterator["warnings._Record"]: + def __iter__(self) -> Iterator["warnings.WarningMessage"]: """Iterate through the recorded warnings.""" return iter(self._list) @@ -158,7 +158,7 @@ class WarningsRecorder(warnings.catch_warnings): """The number of recorded warnings.""" return len(self._list) - def pop(self, cls: "Type[Warning]" = Warning) -> "warnings._Record": + def pop(self, cls: "Type[Warning]" = Warning) -> "warnings.WarningMessage": """Pop the first recorded warning, raise exception if not exists.""" for i, w in enumerate(self._list): if issubclass(w.category, cls): diff --git a/src/_pytest/reports.py b/src/_pytest/reports.py index 4fa465ea7..25d8bf28b 100644 --- a/src/_pytest/reports.py +++ b/src/_pytest/reports.py @@ -55,7 +55,7 @@ class BaseReport: def toterminal(self, out) -> None: if hasattr(self, "node"): - out.line(getslaveinfoline(self.node)) # type: ignore + out.line(getslaveinfoline(self.node)) longrepr = self.longrepr if longrepr is None: diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index 7127ac74b..b0a2d2530 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -480,7 +480,7 @@ class TerminalReporter: self._write_progress_information_filling_space() else: self.ensure_newline() - self._tw.write("[%s]" % rep.node.gateway.id) # type: ignore + self._tw.write("[%s]" % rep.node.gateway.id) if self._show_progress_info: self._tw.write( self._get_progress_information_message() + " ", cyan=True