diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b6e8611..52c7a50 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,29 +1,32 @@ --- repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.2.2 + rev: v0.14.0 hooks: - id: ruff-format args: ["--preview"] - id: ruff args: ["--exit-non-zero-on-fix"] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v6.0.0 hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: fix-encoding-pragma - args: [--remove] - - id: check-yaml - - id: debug-statements - language_version: python3 + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: debug-statements + language_version: python3 + - repo: https://github.com/asottile/pyupgrade + rev: v3.21.0 + hooks: + - id: pyupgrade + args: [--py310-plus] - repo: https://github.com/sphinx-contrib/sphinx-lint - rev: v0.9.1 + rev: v1.0.0 hooks: - id: sphinx-lint args: [--enable=default-role] - repo: https://github.com/tox-dev/pyproject-fmt - rev: 1.7.0 + rev: v2.10.0 hooks: - id: pyproject-fmt additional_dependencies: [ tox ] diff --git a/pyproject.toml b/pyproject.toml index 7096f74..1aee76a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,16 +4,10 @@ requires = [ "setuptools>=40", ] -[tool.check-manifest] -ignore = [".pre-commit-config.yaml"] - [project] name = "pytest-rerunfailures" version = "16.2.dev0" description = "pytest plugin to re-run tests to eliminate flaky failures" -dynamic = [ - "readme", -] keywords = [ "failures", "flaky", @@ -21,7 +15,7 @@ keywords = [ "rerun", ] license.text = "MPL-2.0" -authors = [{name = "Leah Klearman", email = "lklrmn@gmail.com"}] +authors = [ { name = "Leah Klearman", email = "lklrmn@gmail.com" } ] requires-python = ">=3.10" classifiers = [ "Development Status :: 5 - Production/Stable", @@ -42,38 +36,37 @@ classifiers = [ "Topic :: Software Development :: Testing", "Topic :: Utilities", ] +dynamic = [ + "readme", +] dependencies = [ "packaging>=17.1", "pytest!=8.2.2,>=7.4", ] -urls = {Homepage = "https://github.com/pytest-dev/pytest-rerunfailures"} +urls = { Homepage = "https://github.com/pytest-dev/pytest-rerunfailures" } + +entry-points.pytest11.rerunfailures = "pytest_rerunfailures" [tool.setuptools.dynamic] -readme = {file = ["HEADER.rst", "README.rst", "CHANGES.rst"]} +readme = { file = [ "HEADER.rst", "README.rst", "CHANGES.rst" ] } -[project.entry-points.pytest11] -rerunfailures = "pytest_rerunfailures" [tool.ruff] fix = true lint.select = [ - "E", # https://pypi.org/project/pyflakes/ - "W", # https://pypi.org/project/pycodestyle/ - "F", # https://pypi.org/project/pyflakes/ - "I", # https://pypi.org/project/isort/ - "S", # https://pypi.org/project/flake8-bandit/ - "UP", # https://pypi.org/project/upgrade-checker/ + "E", # https://pypi.org/project/pyflakes/ + "F", # https://pypi.org/project/pyflakes/ + "I", # https://pypi.org/project/isort/ + "S", # https://pypi.org/project/flake8-bandit/ + "UP", # https://pypi.org/project/upgrade-checker/ + "W", # https://pypi.org/project/pycodestyle/ ] -[tool.ruff.lint.isort] -known-first-party = ["pytest_rerunfailures"] - -[tool.ruff.lint.per-file-ignores] -"test_*.py" = ["S101", "S311"] - -[tool.ruff.lint.pydocstyle] +lint.per-file-ignores."test_*.py" = [ "S101", "S311" ] +lint.isort.known-first-party = [ "pytest_rerunfailures" ] +# Unlike Flake8, default to a complexity level of 10. +lint.mccabe.max-complexity = 10 # Use Google-style docstrings. -convention = "google" +lint.pydocstyle.convention = "google" -[tool.ruff.lint.mccabe] -# Unlike Flake8, default to a complexity level of 10. -max-complexity = 10 +[tool.check-manifest] +ignore = [ ".pre-commit-config.yaml" ] diff --git a/src/pytest_rerunfailures.py b/src/pytest_rerunfailures.py index b82174c..c344d12 100644 --- a/src/pytest_rerunfailures.py +++ b/src/pytest_rerunfailures.py @@ -206,7 +206,7 @@ def evaluate_condition(item, mark, condition: object) -> bool: result = eval(condition_code, globals_) # noqa: S307 except SyntaxError as exc: msglines = [ - "Error evaluating %r condition" % mark.name, + f"Error evaluating {mark.name!r} condition", " " + condition, " " + " " * (exc.offset or 0) + "^", "SyntaxError: invalid syntax", @@ -214,7 +214,7 @@ def evaluate_condition(item, mark, condition: object) -> bool: fail("\n".join(msglines), pytrace=False) except Exception as exc: msglines = [ - "Error evaluating %r condition" % mark.name, + f"Error evaluating {mark.name!r} condition", " " + condition, *traceback.format_exception_only(type(exc), exc), ] @@ -226,7 +226,7 @@ def evaluate_condition(item, mark, condition: object) -> bool: result = bool(condition) except Exception as exc: msglines = [ - "Error evaluating %r condition as a boolean" % mark.name, + f"Error evaluating {mark.name!r} condition as a boolean", *traceback.format_exception_only(type(exc), exc), ] fail("\n".join(msglines), pytrace=False)