[pre-commit.ci] pre-commit autoupdate (#12321)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.3 → v0.4.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.3...v0.4.4)
- [github.com/tox-dev/pyproject-fmt: 1.8.0 → 2.1.3](https://github.com/tox-dev/pyproject-fmt/compare/1.8.0...2.1.3)

Also fix the comment following autofix

Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
This commit is contained in:
pre-commit-ci[bot] 2024-05-21 07:04:09 +00:00 committed by GitHub
parent 00be7c0739
commit 5d5c9dc858
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 149 additions and 131 deletions

View File

@ -1,6 +1,6 @@
repos: repos:
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.3" rev: "v0.4.4"
hooks: hooks:
- id: ruff - id: ruff
args: ["--fix"] args: ["--fix"]
@ -38,7 +38,7 @@ repos:
# on <3.11 # on <3.11
- exceptiongroup>=1.0.0rc8 - exceptiongroup>=1.0.0rc8
- repo: https://github.com/tox-dev/pyproject-fmt - repo: https://github.com/tox-dev/pyproject-fmt
rev: "1.8.0" rev: "2.1.3"
hooks: hooks:
- id: pyproject-fmt - id: pyproject-fmt
# https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version # https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version

View File

@ -1,3 +1,10 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=61",
"setuptools-scm[toml]>=6.2.3",
]
[project] [project]
name = "pytest" name = "pytest"
description = "pytest: simple powerful testing with Python" description = "pytest: simple powerful testing with Python"
@ -31,7 +38,6 @@ classifiers = [
"Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Testing", "Topic :: Software Development :: Testing",
"Topic :: Utilities", "Topic :: Utilities",
@ -40,15 +46,14 @@ dynamic = [
"version", "version",
] ]
dependencies = [ dependencies = [
'colorama; sys_platform == "win32"', "colorama; sys_platform=='win32'",
'exceptiongroup>=1.0.0rc8; python_version < "3.11"', "exceptiongroup>=1.0.0rc8; python_version<'3.11'",
"iniconfig", "iniconfig",
"packaging", "packaging",
"pluggy<2.0,>=1.5", "pluggy<2,>=1.5",
'tomli>=1; python_version < "3.11"', "tomli>=1; python_version<'3.11'",
] ]
[project.optional-dependencies] optional-dependencies.dev = [
dev = [
"argcomplete", "argcomplete",
"attrs>=19.2", "attrs>=19.2",
"hypothesis>=3.56", "hypothesis>=3.56",
@ -58,59 +63,54 @@ dev = [
"setuptools", "setuptools",
"xmlschema", "xmlschema",
] ]
[project.urls] urls.Changelog = "https://docs.pytest.org/en/stable/changelog.html"
Changelog = "https://docs.pytest.org/en/stable/changelog.html" urls.Homepage = "https://docs.pytest.org/en/latest/"
Homepage = "https://docs.pytest.org/en/latest/" urls.Source = "https://github.com/pytest-dev/pytest"
Source = "https://github.com/pytest-dev/pytest" urls.Tracker = "https://github.com/pytest-dev/pytest/issues"
Tracker = "https://github.com/pytest-dev/pytest/issues" urls.Twitter = "https://twitter.com/pytestdotorg"
Twitter = "https://twitter.com/pytestdotorg" scripts."py.test" = "pytest:console_main"
[project.scripts] scripts.pytest = "pytest:console_main"
"py.test" = "pytest:console_main"
pytest = "pytest:console_main"
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=61",
"setuptools-scm[toml]>=6.2.3",
]
[tool.setuptools.package-data] [tool.setuptools.package-data]
"_pytest" = ["py.typed"] "_pytest" = [
"pytest" = ["py.typed"] "py.typed",
]
"pytest" = [
"py.typed",
]
[tool.setuptools_scm] [tool.setuptools_scm]
write_to = "src/_pytest/_version.py" write_to = "src/_pytest/_version.py"
[tool.black] [tool.black]
target-version = ['py38'] target-version = [
'py38',
]
[tool.ruff] [tool.ruff]
src = ["src"]
line-length = 88 line-length = 88
src = [
[tool.ruff.format] "src",
docstring-code-format = true ]
format.docstring-code-format = true
[tool.ruff.lint] lint.select = [
select = [
"B", # bugbear "B", # bugbear
"D", # pydocstyle "D", # pydocstyle
"E", # pycodestyle "E", # pycodestyle
"F", # pyflakes "F", # pyflakes
"I", # isort "I", # isort
"PYI", # flake8-pyi
"UP", # pyupgrade
"RUF", # ruff
"W", # pycodestyle
"PIE", # flake8-pie
"PGH004", # pygrep-hooks - Use specific rule codes when using noqa "PGH004", # pygrep-hooks - Use specific rule codes when using noqa
"PIE", # flake8-pie
"PLE", # pylint error "PLE", # pylint error
"PLW", # pylint warning
"PLR1714", # Consider merging multiple comparisons "PLR1714", # Consider merging multiple comparisons
"PLW", # pylint warning
"PYI", # flake8-pyi
"RUF", # ruff
"T100", # flake8-debugger "T100", # flake8-debugger
"UP", # pyupgrade
"W", # pycodestyle
] ]
ignore = [ lint.ignore = [
# bugbear ignore # bugbear ignore
"B004", # Using `hasattr(x, "__call__")` to test if x is callable is unreliable. "B004", # Using `hasattr(x, "__call__")` to test if x is callable is unreliable.
"B007", # Loop control variable `i` not used within loop body "B007", # Loop control variable `i` not used within loop body
@ -118,10 +118,6 @@ ignore = [
"B010", # [*] Do not call `setattr` with a constant attribute value. "B010", # [*] Do not call `setattr` with a constant attribute value.
"B011", # Do not `assert False` (`python -O` removes these calls) "B011", # Do not `assert False` (`python -O` removes these calls)
"B028", # No explicit `stacklevel` keyword argument found "B028", # No explicit `stacklevel` keyword argument found
# pycodestyle ignore
# pytest can do weird low-level things, and we usually know
# what we're doing when we use type(..) is ...
"E721", # Do not compare types, use `isinstance()`
# pydocstyle ignore # pydocstyle ignore
"D100", # Missing docstring in public module "D100", # Missing docstring in public module
"D101", # Missing docstring in public class "D101", # Missing docstring in public class
@ -131,41 +127,46 @@ ignore = [
"D105", # Missing docstring in magic method "D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class "D106", # Missing docstring in public nested class
"D107", # Missing docstring in `__init__` "D107", # Missing docstring in `__init__`
"D209", # [*] Multi-line docstring closing quotes should be on a separate line
"D205", # 1 blank line required between summary line and description "D205", # 1 blank line required between summary line and description
"D209", # [*] Multi-line docstring closing quotes should be on a separate line
"D400", # First line should end with a period "D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood "D401", # First line of docstring should be in imperative mood
"D402", # First line should not be the function's signature "D402", # First line should not be the function's signature
"D404", # First word of the docstring should not be "This" "D404", # First word of the docstring should not be "This"
"D415", # First line should end with a period, question mark, or exclamation point "D415", # First line should end with a period, question mark, or exclamation point
# pytest can do weird low-level things, and we usually know
# what we're doing when we use type(..) is ...
"E721", # Do not compare types, use `isinstance()`
# pylint ignore
"PLR5501", # Use `elif` instead of `else` then `if`
"PLW0120", # remove the else and dedent its contents
"PLW0603", # Using the global statement
"PLW2901", # for loop variable overwritten by assignment target
# ruff ignore # ruff ignore
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
# pylint ignore
"PLW0603", # Using the global statement
"PLW0120", # remove the else and dedent its contents
"PLW2901", # for loop variable overwritten by assignment target
"PLR5501", # Use `elif` instead of `else` then `if`
] ]
lint.per-file-ignores."src/_pytest/_py/**/*.py" = [
[tool.ruff.lint.pycodestyle] "B",
"PYI",
]
lint.per-file-ignores."src/_pytest/_version.py" = [
"I001",
]
lint.per-file-ignores."testing/python/approx.py" = [
"B015",
]
lint.isort.combine-as-imports = true
lint.isort.force-single-line = true
lint.isort.force-sort-within-sections = true
lint.isort.known-local-folder = [
"pytest",
"_pytest",
]
lint.isort.lines-after-imports = 2
lint.isort.order-by-type = false
# In order to be able to format for 88 char in ruff format # In order to be able to format for 88 char in ruff format
max-line-length = 120 lint.pycodestyle.max-line-length = 120
lint.pydocstyle.convention = "pep257"
[tool.ruff.lint.pydocstyle]
convention = "pep257"
[tool.ruff.lint.isort]
force-single-line = true
combine-as-imports = true
force-sort-within-sections = true
order-by-type = false
known-local-folder = ["pytest", "_pytest"]
lines-after-imports = 2
[tool.ruff.lint.per-file-ignores]
"src/_pytest/_py/**/*.py" = ["B", "PYI"]
"src/_pytest/_version.py" = ["I001"]
"testing/python/approx.py" = ["B015"]
[tool.pylint.main] [tool.pylint.main]
# Maximum number of characters on a single line. # Maximum number of characters on a single line.
@ -291,11 +292,22 @@ indent = 4
[tool.pytest.ini_options] [tool.pytest.ini_options]
minversion = "2.0" minversion = "2.0"
addopts = "-rfEX -p pytester --strict-markers" addopts = "-rfEX -p pytester --strict-markers"
python_files = ["test_*.py", "*_test.py", "testing/python/*.py"] python_files = [
python_classes = ["Test", "Acceptance"] "test_*.py",
python_functions = ["test"] "*_test.py",
"testing/python/*.py",
]
python_classes = [
"Test",
"Acceptance",
]
python_functions = [
"test",
]
# NOTE: "doc" is not included here, but gets tested explicitly via "doctesting". # NOTE: "doc" is not included here, but gets tested explicitly via "doctesting".
testpaths = ["testing"] testpaths = [
"testing",
]
norecursedirs = [ norecursedirs = [
"testing/example_scripts", "testing/example_scripts",
".*", ".*",
@ -396,8 +408,14 @@ template = "changelog/_template.rst"
showcontent = true showcontent = true
[tool.mypy] [tool.mypy]
files = ["src", "testing", "scripts"] files = [
mypy_path = ["src"] "src",
"testing",
"scripts",
]
mypy_path = [
"src",
]
check_untyped_defs = true check_untyped_defs = true
disallow_any_generics = true disallow_any_generics = true
disallow_untyped_defs = true disallow_untyped_defs = true