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
|
# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
[tox]
envlist =
py313-{django42}-{nonsigning,signing}-unit-tests,
py313-client-tests,
ruff,
format,
codespell,
mypy,
# Ensure we have no warnings on last Django LTS
py313-django42-nonsigning-no-warnings,
# Ensure we don't have missing migration files
py313-django42-migrations
skipsdist = True
skip_missing_interpreters = True
[testenv]
setenv =
LANG=C
PYTHONASYNCIODEBUG=1
PYTHONDEBUG=1
passenv =
PGHOST
PGPASSWORD
PGPORT
PGUSER
PYTHONDEVMODE
commands =
nonsigning-unit-tests: {envpython} -m pytest --ignore=debusine/signing
signing-unit-tests: {envpython} -m pytest --ds=debusine.signing.settings debusine/signing
nonsigning-no-warnings: {envpython} -W error -m pytest --ignore=debusine/signing
nonsigning-show-warnings: {envpython} -W all -m pytest --ignore=debusine/signing
check: {envpython} ./manage.py check {posargs}
migrations: {envpython} ./manage.py makemigrations --check --dry-run {posargs}
deps =
-e.
django42: Django>=4.2,<5.3
migrations: -e.[server]
nonsigning: -e.[client,server,tests]
signing: -e.[signing,tests]
[testenv:ruff]
commands = {envpython} -m ruff check {posargs}
deps = ruff
[testenv:format]
commands = {envpython} -m ruff format {posargs}
{envpython} -m djlint --reformat debusine/web/templates {posargs}
deps = djlint
ruff
[testenv:djlint]
setenv = LANG=C.UTF-8
commands = {envpython} -m djlint --check debusine/web/templates {posargs}
{envpython} -m djlint --lint debusine/web/templates {posargs}
deps = djlint
[testenv:codespell]
allowlist_externals = codespell
commands = codespell -I .codespell-ignore --skip="./data/*" {posargs}
deps = codespell
[testenv:mypy]
commands = mypy {posargs}
deps =
mypy
.[server,client,signing,tests]
boto3-stubs[boto3,ec2,s3]
django-stubs[compatible-mypy]
djangorestframework-stubs
pydantic[email]
responses != 0.25.5
types-lxml
types-paramiko
types-psutil
types-pygments
types-python-dateutil
types-PyYAML
types-requests
[testenv:shellcheck]
allowlist_externals = sh
commands = sh -c '\
(git ls-files | file --mime-type --no-pad --no-buffer --files-from - | \
grep ": text/x-shellscript\$" | cut -d: -f1; \
echo debian/tests/utils/add-debusine-log-files-to-artifacts.sh) \
| xargs shellcheck'
deps =
shellcheck-py
[flake8]
max-complexity = 12
max-line-length = 80
exclude = .git,.ropeproject,.tox,__pycache__,debusine/project/settings/local.py,debusine/signing/settings/local.py,docs/conf.py,*/migrations/[0-9]*.py
ignore =
# class attribute shadow a builtin function
A003,
# line break after/before binary operator
W504, W503
# rules for flake8-docstrings
# docstring - "Missing docstring in public nested class"
D106,
# docstring - "Multi-line docstring summary should start at the first line"
D212,
# docstring - "1 blank line required before class docstring"
D203,
# https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#flake8
# whitespace before ':' (conflicts with black/ruff)
E203,
# multiple statements on one line (def) (conflicts with black/ruff)
E704,
# an unused argument starting with an underscore
U101,
per-file-ignores=
# D102 Missing docstring in public method
# (unfortunately it cannot be ignored only in test_* methods)
# D205 1 blank line required between summary line and description
# D400 First line should end with a period
# D401 First line should be in imperative mood
# D415 First line should end with a period, question mark, or exclamation point
*/tests/test_*.py,debusine/web/templatetags_tests/test_*.py:D102,D205,D400,D401,D415
builtins-allowed-modules =
# Shadowed by debusine.server.collections, but since we always use absolute
# imports this doesn't cause a problem.
collections,
enable-extensions = G
application-import-names = debusine
rst-directives = graphviz dynamic_data deprecated
rst-roles =
# docs/_ext/debusine_sphinx.py
artifact
asset
bare-data
collection
file-backend
task
workflow
# https://www.sphinx-doc.org/en/master/usage/referencing.html#role-ref
ref
# https://www.sphinx-doc.org/en/master/usage/domains/python.html
py:attr
py:class
py:const
py:data
py:exc
py:func
py:meth
py:mod
py:obj
[pycodestyle]
max-line-length = 80
|