200 lines
6.8 KiB
TOML
200 lines
6.8 KiB
TOML
[build-system]
|
|
requires = [
|
|
"setuptools>=45.0",
|
|
"setuptools-scm[toml]>=6.2.3",
|
|
]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[tool.setuptools_scm]
|
|
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]
|
|
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]
|
|
src = ["src"]
|
|
line-length = 88
|
|
select = [
|
|
"B", # bugbear
|
|
"D", # pydocstyle
|
|
"E", # pycodestyle
|
|
"F", # pyflakes
|
|
"I", # isort
|
|
"UP", # pyupgrade
|
|
"RUF", # ruff
|
|
"W", # pycodestyle
|
|
]
|
|
ignore = [
|
|
# bugbear ignore
|
|
"B004", # Using `hasattr(x, "__call__")` to test if x is callable is unreliable.
|
|
"B005", # Using `.strip()` with multi-character strings is misleading
|
|
"B006", # Do not use mutable data structures for argument defaults
|
|
"B007", # Loop control variable `i` not used within loop body
|
|
"B009", # Do not call `getattr` 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)
|
|
"B015", # Pointless comparison. Did you mean to assign a value?
|
|
"B017", # `pytest.raises(Exception)` should be considered evil
|
|
"B018", # Found useless expression.
|
|
"B023", # Function definition does not bind loop variable `warning`
|
|
"B028", # No explicit `stacklevel` keyword argument found
|
|
"B904", # Within an `except` clause, raise exceptions with `raise ... from err`
|
|
# 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
|
|
"D100", # Missing docstring in public module
|
|
"D101", # Missing docstring in public class
|
|
"D102", # Missing docstring in public method
|
|
"D103", # Missing docstring in public function
|
|
"D104", # Missing docstring in public package
|
|
"D105", # Missing docstring in magic method
|
|
"D106", # Missing docstring in public nested class
|
|
"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
|
|
"D400", # First line should end with a period
|
|
"D401", # First line of docstring should be in imperative mood
|
|
"D402", # First line should not be the function's signature
|
|
"D404", # First word of the docstring should not be "This"
|
|
"D415", # First line should end with a period, question mark, or exclamation point
|
|
# ruff ignore
|
|
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
|
|
]
|
|
|
|
[tool.ruff.format]
|
|
docstring-code-format = true
|
|
|
|
[tool.ruff.lint.pycodestyle]
|
|
# In order to be able to format for 88 char in ruff format
|
|
max-line-length = 120
|
|
|
|
[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/_version.py" = ["I001"]
|
|
"src/_pytest/_py/**/*.py" = ["B", "PYI"]
|