| 1 |
[project] |
| 2 |
name = "pytest" |
| 3 |
description = "pytest: simple powerful testing with Python" |
| 4 |
readme = "README.rst" |
| 5 |
keywords = [ |
| 6 |
"test", |
| 7 |
"unittest", |
| 8 |
] |
| 9 |
license = {text = "MIT"} |
| 10 |
authors = [ |
| 11 |
{name = "Holger Krekel"}, |
| 12 |
{name = "Bruno Oliveira"}, |
| 13 |
{name = "Ronny Pfannschmidt"}, |
| 14 |
{name = "Floris Bruynooghe"}, |
| 15 |
{name = "Brianna Laugher"}, |
| 16 |
{name = "Florian Bruhin"}, |
| 17 |
{name = "Others (See AUTHORS)"}, |
| 18 |
] |
| 19 |
requires-python = ">=3.8" |
| 20 |
classifiers = [ |
| 21 |
"Development Status :: 6 - Mature", |
| 22 |
"Intended Audience :: Developers", |
| 23 |
"License :: OSI Approved :: MIT License", |
| 24 |
"Operating System :: MacOS", |
| 25 |
"Operating System :: Microsoft :: Windows", |
| 26 |
"Operating System :: POSIX", |
| 27 |
"Operating System :: Unix", |
| 28 |
"Programming Language :: Python :: 3 :: Only", |
| 29 |
"Programming Language :: Python :: 3.8", |
| 30 |
"Programming Language :: Python :: 3.9", |
| 31 |
"Programming Language :: Python :: 3.10", |
| 32 |
"Programming Language :: Python :: 3.11", |
| 33 |
"Programming Language :: Python :: 3.12", |
| 34 |
"Programming Language :: Python :: 3.13", |
| 35 |
"Topic :: Software Development :: Libraries", |
| 36 |
"Topic :: Software Development :: Testing", |
| 37 |
"Topic :: Utilities", |
| 38 |
] |
| 39 |
dynamic = [ |
| 40 |
"version", |
| 41 |
] |
| 42 |
dependencies = [ |
| 43 |
'colorama; sys_platform == "win32"', |
| 44 |
'exceptiongroup>=1.0.0rc8; python_version < "3.11"', |
| 45 |
"iniconfig", |
| 46 |
"packaging", |
| 47 |
"pluggy<2.0,>=1.5", |
| 48 |
'tomli>=1; python_version < "3.11"', |
| 49 |
] |
| 50 |
[project.optional-dependencies] |
| 51 |
dev = [ |
| 52 |
"argcomplete", |
| 53 |
"attrs>=19.2", |
| 54 |
"hypothesis>=3.56", |
| 55 |
"mock", |
| 56 |
"pygments>=2.7.2", |
| 57 |
"requests", |
| 58 |
"setuptools", |
| 59 |
"xmlschema", |
| 60 |
] |
| 61 |
[project.urls] |
| 62 |
Changelog = "https://docs.pytest.org/en/stable/changelog.html" |
| 63 |
Homepage = "https://docs.pytest.org/en/latest/" |
| 64 |
Source = "https://github.com/pytest-dev/pytest" |
| 65 |
Tracker = "https://github.com/pytest-dev/pytest/issues" |
| 66 |
Twitter = "https://twitter.com/pytestdotorg" |
| 67 |
[project.scripts] |
| 68 |
"py.test" = "pytest:console_main" |
| 69 |
pytest = "pytest:console_main" |
| 70 |
|
| 71 |
[build-system] |
| 72 |
build-backend = "setuptools.build_meta" |
| 73 |
requires = [ |
| 74 |
"setuptools>=61", |
| 75 |
"setuptools-scm[toml]>=6.2.3", |
| 76 |
] |
| 77 |
|
| 78 |
[tool.setuptools.package-data] |
| 79 |
"_pytest" = ["py.typed"] |
| 80 |
"pytest" = ["py.typed"] |
| 81 |
|
| 82 |
[tool.setuptools_scm] |
| 83 |
write_to = "src/_pytest/_version.py" |
| 84 |
|
| 85 |
[tool.black] |
| 86 |
target-version = ['py38'] |
| 87 |
|
| 88 |
[tool.ruff] |
| 89 |
src = ["src"] |
| 90 |
line-length = 88 |
| 91 |
|
| 92 |
[tool.ruff.format] |
| 93 |
docstring-code-format = true |
| 94 |
|
| 95 |
[tool.ruff.lint] |
| 96 |
select = [ |
| 97 |
"B", # bugbear |
| 98 |
"D", # pydocstyle |
| 99 |
"E", # pycodestyle |
| 100 |
"F", # pyflakes |
| 101 |
"I", # isort |
| 102 |
"PYI", # flake8-pyi |
| 103 |
"UP", # pyupgrade |
| 104 |
"RUF", # ruff |
| 105 |
"W", # pycodestyle |
| 106 |
"PIE", # flake8-pie |
| 107 |
"PGH004", # pygrep-hooks - Use specific rule codes when using noqa |
| 108 |
"PLE", # pylint error |
| 109 |
"PLW", # pylint warning |
| 110 |
"PLR1714", # Consider merging multiple comparisons |
| 111 |
] |
| 112 |
ignore = [ |
| 113 |
# bugbear ignore |
| 114 |
"B004", # Using `hasattr(x, "__call__")` to test if x is callable is unreliable. |
| 115 |
"B007", # Loop control variable `i` not used within loop body |
| 116 |
"B009", # Do not call `getattr` with a constant attribute value |
| 117 |
"B010", # [*] Do not call `setattr` with a constant attribute value. |
| 118 |
"B011", # Do not `assert False` (`python -O` removes these calls) |
| 119 |
"B028", # No explicit `stacklevel` keyword argument found |
| 120 |
# pycodestyle ignore |
| 121 |
# pytest can do weird low-level things, and we usually know |
| 122 |
# what we're doing when we use type(..) is ... |
| 123 |
"E721", # Do not compare types, use `isinstance()` |
| 124 |
# pydocstyle ignore |
| 125 |
"D100", # Missing docstring in public module |
| 126 |
"D101", # Missing docstring in public class |
| 127 |
"D102", # Missing docstring in public method |
| 128 |
"D103", # Missing docstring in public function |
| 129 |
"D104", # Missing docstring in public package |
| 130 |
"D105", # Missing docstring in magic method |
| 131 |
"D106", # Missing docstring in public nested class |
| 132 |
"D107", # Missing docstring in `__init__` |
| 133 |
"D209", # [*] Multi-line docstring closing quotes should be on a separate line |
| 134 |
"D205", # 1 blank line required between summary line and description |
| 135 |
"D400", # First line should end with a period |
| 136 |
"D401", # First line of docstring should be in imperative mood |
| 137 |
"D402", # First line should not be the function's signature |
| 138 |
"D404", # First word of the docstring should not be "This" |
| 139 |
"D415", # First line should end with a period, question mark, or exclamation point |
| 140 |
# ruff ignore |
| 141 |
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` |
| 142 |
# pylint ignore |
| 143 |
"PLW0603", # Using the global statement |
| 144 |
"PLW0120", # remove the else and dedent its contents |
| 145 |
"PLW2901", # for loop variable overwritten by assignment target |
| 146 |
"PLR5501", # Use `elif` instead of `else` then `if` |
| 147 |
] |
| 148 |
|
| 149 |
[tool.ruff.lint.pycodestyle] |
| 150 |
# In order to be able to format for 88 char in ruff format |
| 151 |
max-line-length = 120 |
| 152 |
|
| 153 |
[tool.ruff.lint.pydocstyle] |
| 154 |
convention = "pep257" |
| 155 |
|
| 156 |
[tool.ruff.lint.isort] |
| 157 |
force-single-line = true |
| 158 |
combine-as-imports = true |
| 159 |
force-sort-within-sections = true |
| 160 |
order-by-type = false |
| 161 |
known-local-folder = ["pytest", "_pytest"] |
| 162 |
lines-after-imports = 2 |
| 163 |
|
| 164 |
[tool.ruff.lint.per-file-ignores] |
| 165 |
"src/_pytest/_py/**/*.py" = ["B", "PYI"] |
| 166 |
"src/_pytest/_version.py" = ["I001"] |
| 167 |
"testing/python/approx.py" = ["B015"] |
| 168 |
|
| 169 |
[tool.pylint.main] |
| 170 |
# Maximum number of characters on a single line. |
| 171 |
max-line-length = 120 |
| 172 |
disable= [ |
| 173 |
"abstract-method", |
| 174 |
"arguments-differ", |
| 175 |
"arguments-renamed", |
| 176 |
"assigning-non-slot", |
| 177 |
"attribute-defined-outside-init", |
| 178 |
"bad-classmethod-argument", |
| 179 |
"bad-mcs-method-argument", |
| 180 |
"broad-exception-caught", |
| 181 |
"broad-exception-raised", |
| 182 |
"cell-var-from-loop", |
| 183 |
"comparison-of-constants", |
| 184 |
"comparison-with-callable", |
| 185 |
"comparison-with-itself", |
| 186 |
"condition-evals-to-constant", |
| 187 |
"consider-using-dict-items", |
| 188 |
"consider-using-enumerate", |
| 189 |
"consider-using-from-import", |
| 190 |
"consider-using-f-string", |
| 191 |
"consider-using-in", |
| 192 |
"consider-using-sys-exit", |
| 193 |
"consider-using-ternary", |
| 194 |
"consider-using-with", |
| 195 |
"cyclic-import", |
| 196 |
"disallowed-name", |
| 197 |
"duplicate-code", |
| 198 |
"eval-used", |
| 199 |
"exec-used", |
| 200 |
"expression-not-assigned", |
| 201 |
"fixme", |
| 202 |
"global-statement", |
| 203 |
"implicit-str-concat", |
| 204 |
"import-error", |
| 205 |
"import-outside-toplevel", |
| 206 |
"inconsistent-return-statements", |
| 207 |
"invalid-bool-returned", |
| 208 |
"invalid-name", |
| 209 |
"invalid-repr-returned", |
| 210 |
"invalid-str-returned", |
| 211 |
"keyword-arg-before-vararg", |
| 212 |
"line-too-long", |
| 213 |
"method-hidden", |
| 214 |
"misplaced-bare-raise", |
| 215 |
"missing-docstring", |
| 216 |
"missing-timeout", |
| 217 |
"multiple-statements", |
| 218 |
"no-else-break", |
| 219 |
"no-else-continue", |
| 220 |
"no-else-raise", |
| 221 |
"no-else-return", |
| 222 |
"no-member", |
| 223 |
"no-name-in-module", |
| 224 |
"no-self-argument", |
| 225 |
"not-an-iterable", |
| 226 |
"not-callable", |
| 227 |
"pointless-exception-statement", |
| 228 |
"pointless-statement", |
| 229 |
"pointless-string-statement", |
| 230 |
"protected-access", |
| 231 |
"raise-missing-from", |
| 232 |
"redefined-argument-from-local", |
| 233 |
"redefined-builtin", |
| 234 |
"redefined-outer-name", |
| 235 |
"reimported", |
| 236 |
"simplifiable-condition", |
| 237 |
"simplifiable-if-expression", |
| 238 |
"singleton-comparison", |
| 239 |
"superfluous-parens", |
| 240 |
"super-init-not-called", |
| 241 |
"too-few-public-methods", |
| 242 |
"too-many-ancestors", |
| 243 |
"too-many-arguments", |
| 244 |
"too-many-branches", |
| 245 |
"too-many-function-args", |
| 246 |
"too-many-instance-attributes", |
| 247 |
"too-many-lines", |
| 248 |
"too-many-locals", |
| 249 |
"too-many-nested-blocks", |
| 250 |
"too-many-public-methods", |
| 251 |
"too-many-return-statements", |
| 252 |
"too-many-statements", |
| 253 |
"try-except-raise", |
| 254 |
"typevar-name-incorrect-variance", |
| 255 |
"unbalanced-tuple-unpacking", |
| 256 |
"undefined-loop-variable", |
| 257 |
"undefined-variable", |
| 258 |
"unexpected-keyword-arg", |
| 259 |
"unidiomatic-typecheck", |
| 260 |
"unnecessary-comprehension", |
| 261 |
"unnecessary-dunder-call", |
| 262 |
"unnecessary-lambda", |
| 263 |
"unnecessary-lambda-assignment", |
| 264 |
"unpacking-non-sequence", |
| 265 |
"unspecified-encoding", |
| 266 |
"unsubscriptable-object", |
| 267 |
"unused-argument", |
| 268 |
"unused-import", |
| 269 |
"unused-variable", |
| 270 |
"used-before-assignment", |
| 271 |
"use-dict-literal", |
| 272 |
"use-implicit-booleaness-not-comparison", |
| 273 |
"use-implicit-booleaness-not-len", |
| 274 |
"useless-else-on-loop", |
| 275 |
"useless-import-alias", |
| 276 |
"useless-return", |
| 277 |
"use-maxsplit-arg", |
| 278 |
"using-constant-test", |
| 279 |
"wrong-import-order", |
| 280 |
] |
| 281 |
|
| 282 |
[tool.check-wheel-contents] |
| 283 |
# check-wheel-contents is executed by the build-and-inspect-python-package action. |
| 284 |
# W009: Wheel contains multiple toplevel library entries |
| 285 |
ignore = "W009" |
| 286 |
|
| 287 |
[tool.pyproject-fmt] |
| 288 |
indent = 4 |
| 289 |
|
| 290 |
[tool.pytest.ini_options] |
| 291 |
minversion = "2.0" |
| 292 |
addopts = "-rfEX -p pytester --strict-markers" |
| 293 |
python_files = ["test_*.py", "*_test.py", "testing/python/*.py"] |
| 294 |
python_classes = ["Test", "Acceptance"] |
| 295 |
python_functions = ["test"] |
| 296 |
# NOTE: "doc" is not included here, but gets tested explicitly via "doctesting". |
| 297 |
testpaths = ["testing"] |
| 298 |
norecursedirs = [ |
| 299 |
"testing/example_scripts", |
| 300 |
".*", |
| 301 |
"build", |
| 302 |
"dist", |
| 303 |
] |
| 304 |
xfail_strict = true |
| 305 |
filterwarnings = [ |
| 306 |
"error", |
| 307 |
"default:Using or importing the ABCs:DeprecationWarning:unittest2.*", |
| 308 |
# produced by older pyparsing<=2.2.0. |
| 309 |
"default:Using or importing the ABCs:DeprecationWarning:pyparsing.*", |
| 310 |
"default:the imp module is deprecated in favour of importlib:DeprecationWarning:nose.*", |
| 311 |
# distutils is deprecated in 3.10, scheduled for removal in 3.12 |
| 312 |
"ignore:The distutils package is deprecated:DeprecationWarning", |
| 313 |
# produced by pytest-xdist |
| 314 |
"ignore:.*type argument to addoption.*:DeprecationWarning", |
| 315 |
# produced on execnet (pytest-xdist) |
| 316 |
"ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning", |
| 317 |
# pytest's own futurewarnings |
| 318 |
"ignore::pytest.PytestExperimentalApiWarning", |
| 319 |
# Do not cause SyntaxError for invalid escape sequences in py37. |
| 320 |
# Those are caught/handled by pyupgrade, and not easy to filter with the |
| 321 |
# module being the filename (with .py removed). |
| 322 |
"default:invalid escape sequence:DeprecationWarning", |
| 323 |
# ignore not yet fixed warnings for hook markers |
| 324 |
"default:.*not marked using pytest.hook.*", |
| 325 |
"ignore:.*not marked using pytest.hook.*::xdist.*", |
| 326 |
# ignore use of unregistered marks, because we use many to test the implementation |
| 327 |
"ignore::_pytest.warning_types.PytestUnknownMarkWarning", |
| 328 |
# https://github.com/benjaminp/six/issues/341 |
| 329 |
"ignore:_SixMetaPathImporter\\.exec_module\\(\\) not found; falling back to load_module\\(\\):ImportWarning", |
| 330 |
# https://github.com/benjaminp/six/pull/352 |
| 331 |
"ignore:_SixMetaPathImporter\\.find_spec\\(\\) not found; falling back to find_module\\(\\):ImportWarning", |
| 332 |
# https://github.com/pypa/setuptools/pull/2517 |
| 333 |
"ignore:VendorImporter\\.find_spec\\(\\) not found; falling back to find_module\\(\\):ImportWarning", |
| 334 |
# https://github.com/pytest-dev/execnet/pull/127 |
| 335 |
"ignore:isSet\\(\\) is deprecated, use is_set\\(\\) instead:DeprecationWarning", |
| 336 |
] |
| 337 |
pytester_example_dir = "testing/example_scripts" |
| 338 |
markers = [ |
| 339 |
# dummy markers for testing |
| 340 |
"foo", |
| 341 |
"bar", |
| 342 |
"baz", |
| 343 |
# conftest.py reorders tests moving slow ones to the end of the list |
| 344 |
"slow", |
| 345 |
# experimental mark for all tests using pexpect |
| 346 |
"uses_pexpect", |
| 347 |
] |
| 348 |
|
| 349 |
[tool.towncrier] |
| 350 |
package = "pytest" |
| 351 |
package_dir = "src" |
| 352 |
filename = "doc/en/changelog.rst" |
| 353 |
directory = "changelog/" |
| 354 |
title_format = "pytest {version} ({project_date})" |
| 355 |
template = "changelog/_template.rst" |
| 356 |
|
| 357 |
[[tool.towncrier.type]] |
| 358 |
directory = "breaking" |
| 359 |
name = "Breaking Changes" |
| 360 |
showcontent = true |
| 361 |
|
| 362 |
[[tool.towncrier.type]] |
| 363 |
directory = "deprecation" |
| 364 |
name = "Deprecations" |
| 365 |
showcontent = true |
| 366 |
|
| 367 |
[[tool.towncrier.type]] |
| 368 |
directory = "feature" |
| 369 |
name = "Features" |
| 370 |
showcontent = true |
| 371 |
|
| 372 |
[[tool.towncrier.type]] |
| 373 |
directory = "improvement" |
| 374 |
name = "Improvements" |
| 375 |
showcontent = true |
| 376 |
|
| 377 |
[[tool.towncrier.type]] |
| 378 |
directory = "bugfix" |
| 379 |
name = "Bug Fixes" |
| 380 |
showcontent = true |
| 381 |
|
| 382 |
[[tool.towncrier.type]] |
| 383 |
directory = "vendor" |
| 384 |
name = "Vendored Libraries" |
| 385 |
showcontent = true |
| 386 |
|
| 387 |
[[tool.towncrier.type]] |
| 388 |
directory = "doc" |
| 389 |
name = "Improved Documentation" |
| 390 |
showcontent = true |
| 391 |
|
| 392 |
[[tool.towncrier.type]] |
| 393 |
directory = "trivial" |
| 394 |
name = "Trivial/Internal Changes" |
| 395 |
showcontent = true |
| 396 |
|
| 397 |
[tool.mypy] |
| 398 |
files = ["src", "testing", "scripts"] |
| 399 |
mypy_path = ["src"] |
| 400 |
check_untyped_defs = true |
| 401 |
disallow_any_generics = true |
| 402 |
disallow_untyped_defs = true |
| 403 |
ignore_missing_imports = true |
| 404 |
show_error_codes = true |
| 405 |
strict_equality = true |
| 406 |
warn_redundant_casts = true |
| 407 |
warn_return_any = true |
| 408 |
warn_unreachable = true |
| 409 |
warn_unused_configs = true |
| 410 |
no_implicit_reexport = true |
| 411 |
warn_unused_ignores = true |