[pyproject-fmt] Add pre-commit hook and autofix existing
This commit is contained in:
parent
404d31a942
commit
757778f5f6
|
@ -42,6 +42,12 @@ repos:
|
||||||
# for mypy running on python>=3.11 since exceptiongroup is only a dependency
|
# for mypy running on python>=3.11 since exceptiongroup is only a dependency
|
||||||
# on <3.11
|
# on <3.11
|
||||||
- exceptiongroup>=1.0.0rc8
|
- exceptiongroup>=1.0.0rc8
|
||||||
|
- repo: https://github.com/tox-dev/pyproject-fmt
|
||||||
|
rev: "1.7.0"
|
||||||
|
hooks:
|
||||||
|
- id: pyproject-fmt
|
||||||
|
# https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version
|
||||||
|
additional_dependencies: ["tox>=4.9"]
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: rst
|
- id: rst
|
||||||
|
|
276
pyproject.toml
276
pyproject.toml
|
@ -1,7 +1,12 @@
|
||||||
[project]
|
[project]
|
||||||
name = "pytest"
|
name = "pytest"
|
||||||
dynamic = ["version"]
|
|
||||||
description = "pytest: simple powerful testing with Python"
|
description = "pytest: simple powerful testing with Python"
|
||||||
|
readme = "README.rst"
|
||||||
|
keywords = [
|
||||||
|
"test",
|
||||||
|
"unittest",
|
||||||
|
]
|
||||||
|
license = {text = "MIT"}
|
||||||
authors = [
|
authors = [
|
||||||
{name = "Holger Krekel"},
|
{name = "Holger Krekel"},
|
||||||
{name = "Bruno Oliveira"},
|
{name = "Bruno Oliveira"},
|
||||||
|
@ -11,18 +16,15 @@ authors = [
|
||||||
{name = "Florian Bruhin"},
|
{name = "Florian Bruhin"},
|
||||||
{name = "Others (See AUTHORS)"},
|
{name = "Others (See AUTHORS)"},
|
||||||
]
|
]
|
||||||
readme = "README.rst"
|
requires-python = ">=3.8"
|
||||||
license = {text = "MIT"}
|
|
||||||
keywords = ["test", "unittest"]
|
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Development Status :: 6 - Mature",
|
"Development Status :: 6 - Mature",
|
||||||
"Intended Audience :: Developers",
|
"Intended Audience :: Developers",
|
||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
"Operating System :: MacOS",
|
"Operating System :: MacOS",
|
||||||
"Operating System :: Microsoft :: Windows",
|
"Operating System :: Microsoft :: Windows",
|
||||||
"Operating System :: Unix",
|
|
||||||
"Operating System :: POSIX",
|
"Operating System :: POSIX",
|
||||||
"Programming Language :: Python :: 3",
|
"Operating System :: Unix",
|
||||||
"Programming Language :: Python :: 3 :: Only",
|
"Programming Language :: Python :: 3 :: Only",
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
"Programming Language :: Python :: 3.9",
|
"Programming Language :: Python :: 3.9",
|
||||||
|
@ -33,21 +35,21 @@ classifiers = [
|
||||||
"Topic :: Software Development :: Testing",
|
"Topic :: Software Development :: Testing",
|
||||||
"Topic :: Utilities",
|
"Topic :: Utilities",
|
||||||
]
|
]
|
||||||
|
dynamic = [
|
||||||
|
"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>=1.4.0,<2.0",
|
"pluggy<2.0,>=1.4",
|
||||||
"tomli>=1.0.0;python_version<'3.11'",
|
'tomli>=1; python_version < "3.11"',
|
||||||
]
|
]
|
||||||
requires-python = ">=3.8"
|
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
testing = [
|
testing = [
|
||||||
"argcomplete",
|
"argcomplete",
|
||||||
"attrs>=19.2.0",
|
"attrs>=19.2",
|
||||||
"hypothesis>=3.56",
|
"hypothesis>=3.56",
|
||||||
"mock",
|
"mock",
|
||||||
"pygments>=2.7.2",
|
"pygments>=2.7.2",
|
||||||
|
@ -55,24 +57,22 @@ testing = [
|
||||||
"setuptools",
|
"setuptools",
|
||||||
"xmlschema",
|
"xmlschema",
|
||||||
]
|
]
|
||||||
|
[project.urls]
|
||||||
|
Changelog = "https://docs.pytest.org/en/stable/changelog.html"
|
||||||
|
Homepage = "https://docs.pytest.org/en/latest/"
|
||||||
|
Source = "https://github.com/pytest-dev/pytest"
|
||||||
|
Tracker = "https://github.com/pytest-dev/pytest/issues"
|
||||||
|
Twitter = "https://twitter.com/pytestdotorg"
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
"py.test" = "pytest:console_main"
|
"py.test" = "pytest:console_main"
|
||||||
pytest = "pytest:console_main"
|
pytest = "pytest:console_main"
|
||||||
|
|
||||||
[project.urls]
|
|
||||||
Homepage = "https://docs.pytest.org/en/latest/"
|
|
||||||
Changelog = "https://docs.pytest.org/en/stable/changelog.html"
|
|
||||||
Twitter = "https://twitter.com/pytestdotorg"
|
|
||||||
Source = "https://github.com/pytest-dev/pytest"
|
|
||||||
Tracker = "https://github.com/pytest-dev/pytest/issues"
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
requires = [
|
requires = [
|
||||||
"setuptools>=45.0",
|
"setuptools>=45",
|
||||||
"setuptools-scm[toml]>=6.2.3",
|
"setuptools-scm[toml]>=6.2.3",
|
||||||
]
|
]
|
||||||
build-backend = "setuptools.build_meta"
|
|
||||||
|
|
||||||
[tool.setuptools.package-data]
|
[tool.setuptools.package-data]
|
||||||
"_pytest" = ["py.typed"]
|
"_pytest" = ["py.typed"]
|
||||||
|
@ -81,122 +81,9 @@ build-backend = "setuptools.build_meta"
|
||||||
[tool.setuptools_scm]
|
[tool.setuptools_scm]
|
||||||
write_to = "src/_pytest/_version.py"
|
write_to = "src/_pytest/_version.py"
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
|
||||||
minversion = "2.0"
|
|
||||||
addopts = "-rfEX -p pytester --strict-markers"
|
|
||||||
python_files = ["test_*.py", "*_test.py", "testing/python/*.py"]
|
|
||||||
python_classes = ["Test", "Acceptance"]
|
|
||||||
python_functions = ["test"]
|
|
||||||
# NOTE: "doc" is not included here, but gets tested explicitly via "doctesting".
|
|
||||||
testpaths = ["testing"]
|
|
||||||
norecursedirs = [
|
|
||||||
"testing/example_scripts",
|
|
||||||
".*",
|
|
||||||
"build",
|
|
||||||
"dist",
|
|
||||||
]
|
|
||||||
xfail_strict = true
|
|
||||||
filterwarnings = [
|
|
||||||
"error",
|
|
||||||
"default:Using or importing the ABCs:DeprecationWarning:unittest2.*",
|
|
||||||
# produced by older pyparsing<=2.2.0.
|
|
||||||
"default:Using or importing the ABCs:DeprecationWarning:pyparsing.*",
|
|
||||||
"default:the imp module is deprecated in favour of importlib:DeprecationWarning:nose.*",
|
|
||||||
# distutils is deprecated in 3.10, scheduled for removal in 3.12
|
|
||||||
"ignore:The distutils package is deprecated:DeprecationWarning",
|
|
||||||
# produced by pytest-xdist
|
|
||||||
"ignore:.*type argument to addoption.*:DeprecationWarning",
|
|
||||||
# produced on execnet (pytest-xdist)
|
|
||||||
"ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning",
|
|
||||||
# pytest's own futurewarnings
|
|
||||||
"ignore::pytest.PytestExperimentalApiWarning",
|
|
||||||
# Do not cause SyntaxError for invalid escape sequences in py37.
|
|
||||||
# Those are caught/handled by pyupgrade, and not easy to filter with the
|
|
||||||
# module being the filename (with .py removed).
|
|
||||||
"default:invalid escape sequence:DeprecationWarning",
|
|
||||||
# ignore not yet fixed warnings for hook markers
|
|
||||||
"default:.*not marked using pytest.hook.*",
|
|
||||||
"ignore:.*not marked using pytest.hook.*::xdist.*",
|
|
||||||
# ignore use of unregistered marks, because we use many to test the implementation
|
|
||||||
"ignore::_pytest.warning_types.PytestUnknownMarkWarning",
|
|
||||||
# https://github.com/benjaminp/six/issues/341
|
|
||||||
"ignore:_SixMetaPathImporter\\.exec_module\\(\\) not found; falling back to load_module\\(\\):ImportWarning",
|
|
||||||
# https://github.com/benjaminp/six/pull/352
|
|
||||||
"ignore:_SixMetaPathImporter\\.find_spec\\(\\) not found; falling back to find_module\\(\\):ImportWarning",
|
|
||||||
# https://github.com/pypa/setuptools/pull/2517
|
|
||||||
"ignore:VendorImporter\\.find_spec\\(\\) not found; falling back to find_module\\(\\):ImportWarning",
|
|
||||||
# https://github.com/pytest-dev/execnet/pull/127
|
|
||||||
"ignore:isSet\\(\\) is deprecated, use is_set\\(\\) instead:DeprecationWarning",
|
|
||||||
]
|
|
||||||
pytester_example_dir = "testing/example_scripts"
|
|
||||||
markers = [
|
|
||||||
# dummy markers for testing
|
|
||||||
"foo",
|
|
||||||
"bar",
|
|
||||||
"baz",
|
|
||||||
# conftest.py reorders tests moving slow ones to the end of the list
|
|
||||||
"slow",
|
|
||||||
# experimental mark for all tests using pexpect
|
|
||||||
"uses_pexpect",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
[tool.towncrier]
|
|
||||||
package = "pytest"
|
|
||||||
package_dir = "src"
|
|
||||||
filename = "doc/en/changelog.rst"
|
|
||||||
directory = "changelog/"
|
|
||||||
title_format = "pytest {version} ({project_date})"
|
|
||||||
template = "changelog/_template.rst"
|
|
||||||
|
|
||||||
[[tool.towncrier.type]]
|
|
||||||
directory = "breaking"
|
|
||||||
name = "Breaking Changes"
|
|
||||||
showcontent = true
|
|
||||||
|
|
||||||
[[tool.towncrier.type]]
|
|
||||||
directory = "deprecation"
|
|
||||||
name = "Deprecations"
|
|
||||||
showcontent = true
|
|
||||||
|
|
||||||
[[tool.towncrier.type]]
|
|
||||||
directory = "feature"
|
|
||||||
name = "Features"
|
|
||||||
showcontent = true
|
|
||||||
|
|
||||||
[[tool.towncrier.type]]
|
|
||||||
directory = "improvement"
|
|
||||||
name = "Improvements"
|
|
||||||
showcontent = true
|
|
||||||
|
|
||||||
[[tool.towncrier.type]]
|
|
||||||
directory = "bugfix"
|
|
||||||
name = "Bug Fixes"
|
|
||||||
showcontent = true
|
|
||||||
|
|
||||||
[[tool.towncrier.type]]
|
|
||||||
directory = "vendor"
|
|
||||||
name = "Vendored Libraries"
|
|
||||||
showcontent = true
|
|
||||||
|
|
||||||
[[tool.towncrier.type]]
|
|
||||||
directory = "doc"
|
|
||||||
name = "Improved Documentation"
|
|
||||||
showcontent = true
|
|
||||||
|
|
||||||
[[tool.towncrier.type]]
|
|
||||||
directory = "trivial"
|
|
||||||
name = "Trivial/Internal Changes"
|
|
||||||
showcontent = true
|
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
target-version = ['py38']
|
target-version = ['py38']
|
||||||
|
|
||||||
# check-wheel-contents is executed by the build-and-inspect-python-package action.
|
|
||||||
[tool.check-wheel-contents]
|
|
||||||
# W009: Wheel contains multiple toplevel library entries
|
|
||||||
ignore = "W009"
|
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
src = ["src"]
|
src = ["src"]
|
||||||
line-length = 88
|
line-length = 88
|
||||||
|
@ -266,6 +153,121 @@ lines-after-imports = 2
|
||||||
"src/_pytest/_version.py" = ["I001"]
|
"src/_pytest/_version.py" = ["I001"]
|
||||||
"testing/python/approx.py" = ["B015"]
|
"testing/python/approx.py" = ["B015"]
|
||||||
|
|
||||||
|
[tool.check-wheel-contents]
|
||||||
|
# check-wheel-contents is executed by the build-and-inspect-python-package action.
|
||||||
|
# W009: Wheel contains multiple toplevel library entries
|
||||||
|
ignore = "W009"
|
||||||
|
|
||||||
|
[tool.pyproject-fmt]
|
||||||
|
indent = 4
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
minversion = "2.0"
|
||||||
|
addopts = "-rfEX -p pytester --strict-markers"
|
||||||
|
python_files = ["test_*.py", "*_test.py", "testing/python/*.py"]
|
||||||
|
python_classes = ["Test", "Acceptance"]
|
||||||
|
python_functions = ["test"]
|
||||||
|
# NOTE: "doc" is not included here, but gets tested explicitly via "doctesting".
|
||||||
|
testpaths = ["testing"]
|
||||||
|
norecursedirs = [
|
||||||
|
"testing/example_scripts",
|
||||||
|
".*",
|
||||||
|
"build",
|
||||||
|
"dist",
|
||||||
|
]
|
||||||
|
xfail_strict = true
|
||||||
|
filterwarnings = [
|
||||||
|
"error",
|
||||||
|
"default:Using or importing the ABCs:DeprecationWarning:unittest2.*",
|
||||||
|
# produced by older pyparsing<=2.2.0.
|
||||||
|
"default:Using or importing the ABCs:DeprecationWarning:pyparsing.*",
|
||||||
|
"default:the imp module is deprecated in favour of importlib:DeprecationWarning:nose.*",
|
||||||
|
# distutils is deprecated in 3.10, scheduled for removal in 3.12
|
||||||
|
"ignore:The distutils package is deprecated:DeprecationWarning",
|
||||||
|
# produced by pytest-xdist
|
||||||
|
"ignore:.*type argument to addoption.*:DeprecationWarning",
|
||||||
|
# produced on execnet (pytest-xdist)
|
||||||
|
"ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning",
|
||||||
|
# pytest's own futurewarnings
|
||||||
|
"ignore::pytest.PytestExperimentalApiWarning",
|
||||||
|
# Do not cause SyntaxError for invalid escape sequences in py37.
|
||||||
|
# Those are caught/handled by pyupgrade, and not easy to filter with the
|
||||||
|
# module being the filename (with .py removed).
|
||||||
|
"default:invalid escape sequence:DeprecationWarning",
|
||||||
|
# ignore not yet fixed warnings for hook markers
|
||||||
|
"default:.*not marked using pytest.hook.*",
|
||||||
|
"ignore:.*not marked using pytest.hook.*::xdist.*",
|
||||||
|
# ignore use of unregistered marks, because we use many to test the implementation
|
||||||
|
"ignore::_pytest.warning_types.PytestUnknownMarkWarning",
|
||||||
|
# https://github.com/benjaminp/six/issues/341
|
||||||
|
"ignore:_SixMetaPathImporter\\.exec_module\\(\\) not found; falling back to load_module\\(\\):ImportWarning",
|
||||||
|
# https://github.com/benjaminp/six/pull/352
|
||||||
|
"ignore:_SixMetaPathImporter\\.find_spec\\(\\) not found; falling back to find_module\\(\\):ImportWarning",
|
||||||
|
# https://github.com/pypa/setuptools/pull/2517
|
||||||
|
"ignore:VendorImporter\\.find_spec\\(\\) not found; falling back to find_module\\(\\):ImportWarning",
|
||||||
|
# https://github.com/pytest-dev/execnet/pull/127
|
||||||
|
"ignore:isSet\\(\\) is deprecated, use is_set\\(\\) instead:DeprecationWarning",
|
||||||
|
]
|
||||||
|
pytester_example_dir = "testing/example_scripts"
|
||||||
|
markers = [
|
||||||
|
# dummy markers for testing
|
||||||
|
"foo",
|
||||||
|
"bar",
|
||||||
|
"baz",
|
||||||
|
# conftest.py reorders tests moving slow ones to the end of the list
|
||||||
|
"slow",
|
||||||
|
# experimental mark for all tests using pexpect
|
||||||
|
"uses_pexpect",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.towncrier]
|
||||||
|
package = "pytest"
|
||||||
|
package_dir = "src"
|
||||||
|
filename = "doc/en/changelog.rst"
|
||||||
|
directory = "changelog/"
|
||||||
|
title_format = "pytest {version} ({project_date})"
|
||||||
|
template = "changelog/_template.rst"
|
||||||
|
|
||||||
|
[[tool.towncrier.type]]
|
||||||
|
directory = "breaking"
|
||||||
|
name = "Breaking Changes"
|
||||||
|
showcontent = true
|
||||||
|
|
||||||
|
[[tool.towncrier.type]]
|
||||||
|
directory = "deprecation"
|
||||||
|
name = "Deprecations"
|
||||||
|
showcontent = true
|
||||||
|
|
||||||
|
[[tool.towncrier.type]]
|
||||||
|
directory = "feature"
|
||||||
|
name = "Features"
|
||||||
|
showcontent = true
|
||||||
|
|
||||||
|
[[tool.towncrier.type]]
|
||||||
|
directory = "improvement"
|
||||||
|
name = "Improvements"
|
||||||
|
showcontent = true
|
||||||
|
|
||||||
|
[[tool.towncrier.type]]
|
||||||
|
directory = "bugfix"
|
||||||
|
name = "Bug Fixes"
|
||||||
|
showcontent = true
|
||||||
|
|
||||||
|
[[tool.towncrier.type]]
|
||||||
|
directory = "vendor"
|
||||||
|
name = "Vendored Libraries"
|
||||||
|
showcontent = true
|
||||||
|
|
||||||
|
[[tool.towncrier.type]]
|
||||||
|
directory = "doc"
|
||||||
|
name = "Improved Documentation"
|
||||||
|
showcontent = true
|
||||||
|
|
||||||
|
[[tool.towncrier.type]]
|
||||||
|
directory = "trivial"
|
||||||
|
name = "Trivial/Internal Changes"
|
||||||
|
showcontent = true
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
mypy_path = ["src"]
|
mypy_path = ["src"]
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
|
|
Loading…
Reference in New Issue