From 3a6abcc55963df96d29d12bb67b76a672ab0d429 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 00:16:55 +0000 Subject: [PATCH 1/5] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.10 → v0.5.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.10...v0.5.0) - [github.com/adamchainz/blacken-docs: 1.16.0 → 1.18.0](https://github.com/adamchainz/blacken-docs/compare/1.16.0...1.18.0) - [github.com/pre-commit/mirrors-mypy: v1.10.0 → v1.10.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.0...v1.10.1) - pyproject-fmt: 2.1.3 => 2.1.4 Co-authored-by: Pierre Sassoulas --- .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 431b21f9942..ebcc797cc1e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.4.10" + rev: "v0.5.0" hooks: - id: ruff args: ["--fix"] @@ -12,7 +12,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/adamchainz/blacken-docs - rev: 1.16.0 + rev: 1.18.0 hooks: - id: blacken-docs additional_dependencies: [black==24.1.1] @@ -21,7 +21,7 @@ repos: hooks: - id: python-use-type-annotations - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.10.0 + rev: v1.10.1 hooks: - id: mypy files: ^(src/|testing/|scripts/) @@ -38,7 +38,7 @@ repos: # on <3.11 - exceptiongroup>=1.0.0rc8 - repo: https://github.com/tox-dev/pyproject-fmt - rev: "2.1.3" + rev: "2.1.4" hooks: - id: pyproject-fmt # https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version From 375e748e7f4ffd087fdc45062f2148c357a64ed6 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Thu, 4 Jul 2024 11:08:14 +0200 Subject: [PATCH 2/5] [lint] Handle misplaced-bare-raise with ruff instead of pylint --- pyproject.toml | 1 + src/_pytest/logging.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e0ed2b90061..d140ca43c06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -221,6 +221,7 @@ disable = [ "method-hidden", "missing-docstring", "missing-timeout", + "misplaced-bare-raise", # PLE0704 from ruff "multiple-statements", # multiple-statements-on-one-line-colon (E701) from ruff "no-else-break", "no-else-continue", diff --git a/src/_pytest/logging.py b/src/_pytest/logging.py index fe3be060fdd..44af8ff2041 100644 --- a/src/_pytest/logging.py +++ b/src/_pytest/logging.py @@ -399,7 +399,7 @@ def handleError(self, record: logging.LogRecord) -> None: # The default behavior of logging is to print "Logging error" # to stderr with the call stack and some extra details. # pytest wants to make such mistakes visible during testing. - raise # pylint: disable=misplaced-bare-raise + raise # noqa: PLE0704 @final From b2dc022b3039d23140a50faabdb37676f18d5a2d Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Thu, 4 Jul 2024 11:13:22 +0200 Subject: [PATCH 3/5] [ruff] Fix all RUF024 (no mutable objects as values in 'dict.fromkeys' --- testing/test_runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/test_runner.py b/testing/test_runner.py index 79f7a3fd4d3..1b59ff78633 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -533,7 +533,7 @@ class TestClass(object): ) def test_report_extra_parameters(reporttype: type[reports.BaseReport]) -> None: args = list(inspect.signature(reporttype.__init__).parameters.keys())[1:] - basekw: dict[str, list[object]] = dict.fromkeys(args, []) + basekw: dict[str, list[object]] = {arg: [] for arg in args} report = reporttype(newthing=1, **basekw) assert report.newthing == 1 From b2908fd56f998c17f70d74333f81474812aa2b93 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Thu, 4 Jul 2024 11:21:33 +0200 Subject: [PATCH 4/5] [pylint] Disable new messages raised since last pre-commit auto-update --- pyproject.toml | 3 ++- testing/test_mark_expression.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d140ca43c06..1eb4871bc21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -284,7 +284,8 @@ disable = [ "useless-import-alias", "useless-return", "using-constant-test", - "wrong-import-order", + "wrong-import-order", # handled by isort / ruff + "wrong-import-position", # handled by isort / ruff ] [tool.check-wheel-contents] diff --git a/testing/test_mark_expression.py b/testing/test_mark_expression.py index f8f5f9221cf..a61a9f21560 100644 --- a/testing/test_mark_expression.py +++ b/testing/test_mark_expression.py @@ -243,7 +243,7 @@ def mark_matcher() -> MarkMatcher: markers = [ pytest.mark.number_mark(a=1, b=2, c=3, d=999_999).mark, pytest.mark.builtin_matchers_mark(x=True, y=False, z=None).mark, - pytest.mark.str_mark( + pytest.mark.str_mark( # pylint: disable-next=non-ascii-name m="M", space="with space", empty="", aaאבגדcc="aaאבגדcc", אבגד="אבגד" ).mark, ] From 92ec5c349dc92d59bc77233612471d048b19364e Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Thu, 4 Jul 2024 11:46:14 +0200 Subject: [PATCH 5/5] [python 3.13] Mark functool.partial test to be skipped Closes #12552 --- testing/python/fixtures.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/testing/python/fixtures.py b/testing/python/fixtures.py index bc091bb1f27..5c3a6a35b34 100644 --- a/testing/python/fixtures.py +++ b/testing/python/fixtures.py @@ -76,6 +76,16 @@ class B(A): assert getfuncargnames(B.static, cls=B) == ("arg1", "arg2") +@pytest.mark.skipif( + sys.version_info >= (3, 13), + reason="""\ +In python 3.13, this will raise FutureWarning: +functools.partial will be a method descriptor in future Python versions; +wrap it in staticmethod() if you want to preserve the old behavior + +But the wrapped 'functools.partial' is tested by 'test_getfuncargnames_staticmethod_partial' below. +""", +) def test_getfuncargnames_partial(): """Check getfuncargnames for methods defined with functools.partial (#5701)""" import functools