Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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 ]
Expand Down
49 changes: 21 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,18 @@ 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",
"pytest",
"rerun",
]
license.text = "MPL-2.0"
authors = [{name = "Leah Klearman", email = "[email protected]"}]
authors = [ { name = "Leah Klearman", email = "[email protected]" } ]
requires-python = ">=3.10"
classifiers = [
"Development Status :: 5 - Production/Stable",
Expand All @@ -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" ]
6 changes: 3 additions & 3 deletions src/pytest_rerunfailures.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ 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",
]
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),
]
Expand All @@ -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)
Expand Down
Loading