From 4ee6e900a0809c8ad19bba6c705280d65be26905 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Oct 2022 23:32:26 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/PyCQA/autoflake: v1.6.0 → v1.6.1](https://github.com/PyCQA/autoflake/compare/v1.6.0...v1.6.1) - [github.com/asottile/reorder_python_imports: v3.8.2 → v3.8.3](https://github.com/asottile/reorder_python_imports/compare/v3.8.2...v3.8.3) - [github.com/asottile/pyupgrade: v2.38.0 → v2.38.2](https://github.com/asottile/pyupgrade/compare/v2.38.0...v2.38.2) - [github.com/pre-commit/mirrors-mypy: v0.971 → v0.981](https://github.com/pre-commit/mirrors-mypy/compare/v0.971...v0.981) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a8dc8b5b6..663bc64c2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ repos: exclude: _pytest/(debugging|hookspec).py language_version: python3 - repo: https://github.com/PyCQA/autoflake - rev: v1.6.0 + rev: v1.6.1 hooks: - id: autoflake name: autoflake @@ -37,12 +37,12 @@ repos: - flake8-typing-imports==1.12.0 - flake8-docstrings==1.5.0 - repo: https://github.com/asottile/reorder_python_imports - rev: v3.8.2 + rev: v3.8.3 hooks: - id: reorder-python-imports args: ['--application-directories=.:src', --py37-plus] - repo: https://github.com/asottile/pyupgrade - rev: v2.38.0 + rev: v2.38.2 hooks: - id: pyupgrade args: [--py37-plus] @@ -56,7 +56,7 @@ repos: hooks: - id: python-use-type-annotations - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.971 + rev: v0.981 hooks: - id: mypy files: ^(src/|testing/) From 4da06896532809a216bfa7a53b0ff490c5193fe9 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 7 Oct 2022 11:30:24 -0300 Subject: [PATCH 2/2] Ignore mypy error about missing generic arg for catch_warnings mypy stubs recently changed warnings.catch_warnings to a Generic, in order to have proper overloads depending on the parameters passed to it, whihc triggers this mypy error now when we subclass it: src/_pytest/recwarn.py:170: error: Missing type parameters for generic type "catch_warnings" [type-arg] For our porpuses the parameter is not relevant (we always use record=True), so decided to just ignore the type error. --- .pre-commit-config.yaml | 2 ++ src/_pytest/recwarn.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 663bc64c2..19329cb21 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,5 @@ +default_language_version: + python: "3.10" repos: - repo: https://github.com/psf/black rev: 22.8.0 diff --git a/src/_pytest/recwarn.py b/src/_pytest/recwarn.py index 06eb82d71..0ab7ab2de 100644 --- a/src/_pytest/recwarn.py +++ b/src/_pytest/recwarn.py @@ -167,7 +167,7 @@ def warns( # noqa: F811 return func(*args[1:], **kwargs) -class WarningsRecorder(warnings.catch_warnings): +class WarningsRecorder(warnings.catch_warnings): # type:ignore[type-arg] """A context manager to record raised warnings. Each recorded warning is an instance of :class:`warnings.WarningMessage`.