Consolidate tox.ini and pyproject.toml

This commit is contained in:
Peter Bittner 2022-03-06 18:01:13 +01:00
parent 1d9a3b5626
commit 023702fa75
3 changed files with 69 additions and 70 deletions

21
.gitignore vendored
View file

@ -2,18 +2,19 @@
/*.geany
/.idea
/.tox
/.coverage
/coverage.xml
/tests/reports
/build
/dist
/docs/_build
/MANIFEST
/docs/_templates/layout.html
/.vscode
*.pyc
*.pyo
/.coverage
/coverage.xml
/tests/*-report.json
/tests/*-report.xml
/build
/dist
/docs/_build
/docs/_templates/layout.html
/MANIFEST
*.egg-info

View file

@ -1,11 +1,12 @@
[tool.bandit]
# Exclude/ignore of files is currently broken in Bandit.
# Exclude/ignore of files and TOML reading is currently broken in Bandit
exclude = [".cache",".git",".github",".tox","build","dist","docs","tests"]
[tool.black]
color = true
[tool.coverage.xml]
output = "tests/reports/coverage.xml"
output = "tests/coverage-report.xml"
[tool.isort]
color_output = true
@ -15,5 +16,5 @@ profile = "black"
output-format = "colorized"
[tool.pytest.ini_options]
addopts = "--junitxml=tests/reports/unittests.xml --color=yes --verbose"
addopts = "--junitxml=tests/unittests-report.xml --color=yes --verbose"
DJANGO_SETTINGS_MODULE = "tests.testproject.settings"

111
tox.ini
View file

@ -10,63 +10,6 @@ envlist =
readme
docs
[testenv]
description = Unit tests
deps =
coverage
pytest-django
django22: Django>=2.2,<3.0
django32: Django>=3.2,<4.0
django40: Django>=4.0,<4.1
commands =
coverage run -m pytest
coverage xml
[testenv:bandit]
description = PyCQA security linter
deps = bandit<1.6
commands = -bandit --ini tox.ini {posargs:-r .}
[testenv:docs]
description = Build the HTML documentation
deps = sphinx
commands = sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
allowlist_externals = make
[testenv:flake8]
description = Static code analysis and code style
deps = flake8
commands = flake8 {posargs}
[testenv:isort]
description = Ensure imports are ordered consistently
deps = isort[colors]
commands = isort --check-only --diff {posargs:analytical setup.py tests}
skip_install = True
[testenv:readme]
description = Ensure README renders on PyPI
deps = twine
commands =
{envpython} setup.py -q sdist bdist_wheel
twine check dist/*
[testenv:clean]
description = Clean up bytecode and build artifacts
deps = pyclean
commands =
pyclean -v {toxinidir}
rm -rf .tox/ build/ dist/ django_analytical.egg-info/ .coverage coverage.xml
allowlist_externals =
rm
[bandit]
exclude = .git,.github,.tox,build,dist,docs,tests
[flake8]
exclude = .cache,.git,.tox,build,dist
max-line-length = 100
[gh-actions]
python =
3.6: py36
@ -80,3 +23,57 @@ DJANGO =
2.2: django22
3.2: django32
4.0: django40
[testenv]
description = Unit tests
deps =
coverage[toml]
pytest-django
django22: Django>=2.2,<3.0
django32: Django>=3.2,<4.0
django40: Django>=4.0,<4.1
commands =
coverage run -m pytest {posargs}
coverage xml
[testenv:bandit]
description = PyCQA security linter
deps = bandit
commands = -bandit {posargs:-r analytical} -v
[testenv:docs]
description = Build the HTML documentation
deps = sphinx
commands = sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
[testenv:flake8]
description = Static code analysis and code style
deps = flake8
commands = flake8 {posargs}
[testenv:isort]
description = Ensure imports are ordered consistently
deps = isort[colors]
commands = isort --check-only --diff {posargs:analytical setup.py tests}
[testenv:readme]
description = Ensure README renders on PyPI
deps =
build
twine
commands =
python -m build
twine check dist/*
[testenv:clean]
description = Clean up bytecode and build artifacts
deps = pyclean
commands =
pyclean {posargs:.}
rm -rf .tox/ build/ dist/ django_analytical.egg-info/ .coverage coverage.xml tests/coverage-report.xml tests/unittests-report.xml
allowlist_externals =
rm
[flake8]
exclude = .cache,.git,.tox,build,dist
max-line-length = 100