1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
|
[build-system]
requires = [
"setuptools>=61.0.0",
"setuptools-scm[toml]>=5.0.0",
]
build-backend = "setuptools.build_meta"
[project]
name = "pytest-django"
description = "A Django plugin for pytest."
readme = "README.rst"
requires-python = ">=3.10"
dynamic = ["version"]
authors = [
{ name = "Andreas Pelme", email = "andreas@pelme.se" },
]
maintainers = [
{ name = "Andreas Pelme", email = "andreas@pelme.se" },
]
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Django",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.1",
"Framework :: Django :: 5.2",
"Framework :: Django :: 6.0",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Testing",
]
dependencies = [
"pytest>=7.0.0",
]
[dependency-groups]
docs = [
"sphinx",
"sphinx_rtd_theme",
]
testing = [
"Django",
"django-configurations>=2.0",
"pytest>=9",
]
coverage = [
"coverage[toml]",
"coverage-enable-subprocess",
]
postgres = [
"psycopg[binary]",
]
mysql = [
"mysqlclient==2.2.7",
]
xdist = [
"pytest-xdist",
]
linting = [
"editorconfig-checker==3.2.1",
"mypy==1.17.1",
"ruff==0.12.8",
"zizmor==1.11.0",
]
[project.urls]
Documentation = "https://pytest-django.readthedocs.io/"
Repository = "https://github.com/pytest-dev/pytest-django"
Changelog = "https://pytest-django.readthedocs.io/en/latest/changelog.html"
[project.entry-points.pytest11]
django = "pytest_django.plugin"
[tool.setuptools]
packages = ["pytest_django"]
[tool.setuptools.package-data]
pytest_django = ["py.typed"]
[tool.setuptools_scm]
write_to = "pytest_django/_version.py"
[tool.pytest]
addopts = [
# Show extra test summary info for everything.
"-ra",
]
strict = true
pythonpath = ["."]
DJANGO_SETTINGS_MODULE = "pytest_django_test.settings_sqlite_file"
testpaths = ["tests"]
markers = ["tag1", "tag2", "tag3", "tag4", "tag5"]
[tool.mypy]
strict = true
disallow_incomplete_defs = false
disallow_untyped_defs = false
disallow_subclassing_any = false
files = [
"pytest_django",
"pytest_django_test",
"tests",
]
[[tool.mypy.overrides]]
module = [
"django.*",
"configurations.*",
]
ignore_missing_imports = true
[tool.coverage.run]
parallel = true
source = ["${PYTESTDJANGO_COVERAGE_SRC}."]
branch = true
[tool.coverage.report]
include = [
"pytest_django/*",
"pytest_django_test/*",
"tests/*",
]
skip_covered = true
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
]
[tool.ruff]
# preview = true # TODO: Enable this when we have the bandwidth
line-length = 99
extend-exclude = [
"pytest_django/_version.py",
]
[tool.ruff.lint]
extend-select = [
"AIR", # Airflow
"ERA", # eradicate
"FAST", # FastAPI
"YTT", # flake8-2020
"ANN", # flake8-annotations
"ASYNC", # flake8-async
"S", # flake8-bandit
"BLE", # flake8-blind-except
"FBT", # flake8-boolean-trap
"B", # flake8-bugbear
"A", # flake8-builtins
"COM", # flake8-commas
"C4", # flake8-comprehensions
"CPY", # flake8-copyright
"DTZ", # flake8-datetimez
"T10", # flake8-debugger
"DJ", # flake8-django
"EM", # flake8-errmsg
"EXE", # flake8-executable
"FIX", # flake8-fixme
"FA", # flake8-future-annotations
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"LOG", # flake8-logging
"G", # flake8-logging-format
"INP", # flake8-no-pep420
"PIE", # flake8-pie
"T20", # flake8-print
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RSE", # flake8-raise
"RET", # flake8-return
"SLF", # flake8-self
"SIM", # flake8-simplify
"SLOT", # flake8-slots
"TID", # flake8-tidy-imports
"TD", # flake8-todos
"TC", # flake8-type-checking
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"FLY", # flynt
"I", # isort
"C90", # mccabe
"PD", # pandas-vet
"N", # pep8-naming
"PERF", # Perflint
"E", # pycodestyle Error
"W", # pycodestyle Warning
"DOC", # pydoclint
"D", # pydocstyle
"F", # Pyflakes
"PGH", # pygrep-hooks
"PL", # Pylint
"UP", # pyupgrade
"FURB", # refurb
"TRY", # tryceratops
"RUF", # Ruff-specific rules
]
ignore = [
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
"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
"D107", # Missing docstring in __init__
"D200", # One-line docstring should fit on one line
"D202", # No blank lines allowed after function docstring
"D203", # Class definitions that are not preceded by a blank line
"D205", # 1 blank line required between summary line and description
"D209", # Multi-line docstring closing quotes should be on a separate line
"D212", # Multi-line docstring summary should start at the first line
"D213", # Multi-line docstring summary should start at the second line
"D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood
"D404", # First word of the docstring should not be "This"
"D415", # First line should end with a period, question mark, or exclamation point
"S101", # Use of `assert` detected
# TODO - need to fix these
"C901", # .. is too complex
"COM812", # Trailing comma missing
"E501", # Line too long
"EM101", # Exception must not use a string literal, assign to variable first
"EM102", # Exception must not use an f-string literal, assign to variable first
"FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function definition
"FBT003", # Boolean positional value in function call
"N802", # Function name `assertRedirects` should be lowercase
"N806", # Variable `UserModel` in function should be lowercase
"PLC0415", # `import` should be at the top-level of a file
"PLR0913", # Too many arguments in function definition
"PLR2004", # Magic value used in comparison, consider replacing .. with a constant variable
"RET504", # Unnecessary assignment to .. before `return` statement
"RET505", # Unnecessary `elif` after `return` statement
"S105", # Possible hardcoded password assigned
"SIM102", # Use a single `if` statement instead of nested `if` statements
"SIM108", # Use ternary operator .. instead of `if`-`else`-block
"SIM114", # Combine `if` branches using logical `or` operator
"SLF001", # Private member accessed
"TC002", # Move third-party import `django.contrib.messages.Message` into a type-checking block
"TC003", # Move standard library import `collections.abc.Sequence` into a type-checking block
"TRY003", # Avoid specifying long messages outside the exception class
]
[tool.ruff.lint.per-file-ignores]
"tests/*.py" = [
"ANN", # Disable all annotations
"FIX003", # Line contains XXX, consider resolving the issue
"DJ008", # Model does not define .. method
"N801", # Class name should use CapWords convention
"N802", # Function name should be lowercase
"S", # Disable all security checks
"TD001", # Invalid TODO tag
"TD002", # Missing author in TODO
"TD003", # Missing issue link for this TODO
# TODO - need to fix these
"ARG005", # Unused lambda argument
"D300", # Use triple double quotes `"""`
"D403", # First word of the docstring should be capitalized
"ERA001", # Found commented-out code
"SIM117", # Use a single `with` statement with multiple contexts instead of nested `with` statements
"TC001", # Move application import .. into a type-checking block
"TC006", # Add quotes to type expression in `typing.cast()`
"PTH108", # `os.unlink()` should be replaced by `Path.unlink()`
"PTH110", # `os.path.exists()` should be replaced by `Path.exists()`
"RET503", # Missing explicit `return` at the end of function able to return non-`None` value
"RSE102", # Unnecessary parentheses on raised exception
]
"pytest_django_test/*.py" = [
"ANN", # Disable all annotations
"FIX003", # Line contains XXX, consider resolving the issue
"DJ008", # Model does not define .. method
"N801", # Class name should use CapWords convention
"N802", # Function name should be lowercase
"S", # Disable all security checks
"TD001", # Invalid TODO tag
"TD002", # Missing author in TODO
"TD003", # Missing issue link for this TODO
# TODO - need to fix these
"ARG005", # Unused lambda argument
"D300", # Use triple double quotes `"""`
"D403", # First word of the docstring should be capitalized
"ERA001", # Found commented-out code
"SIM117", # Use a single `with` statement with multiple contexts instead of nested `with` statements
"TC001", # Move application import .. into a type-checking block
"TC006", # Add quotes to type expression in `typing.cast()`
"PTH108", # `os.unlink()` should be replaced by `Path.unlink()`
"PTH110", # `os.path.exists()` should be replaced by `Path.exists()`
"RET503", # Missing explicit `return` at the end of function able to return non-`None` value
"RSE102", # Unnecessary parentheses on raised exception
]
[tool.ruff.lint.isort]
forced-separate = [
"tests",
"pytest_django",
"pytest_django_test",
]
combine-as-imports = true
split-on-trailing-comma = false
lines-after-imports = 2
|