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 diff --git a/pyproject.toml b/pyproject.toml index e0ed2b90061..1eb4871bc21 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", @@ -283,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/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 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 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, ] 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