From 023702fa75d1ae1cae68220fc42345254b708e0b Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sun, 6 Mar 2022 18:01:13 +0100 Subject: [PATCH] Consolidate tox.ini and pyproject.toml --- .gitignore | 21 +++++----- pyproject.toml | 7 ++-- tox.ini | 111 ++++++++++++++++++++++++------------------------- 3 files changed, 69 insertions(+), 70 deletions(-) diff --git a/.gitignore b/.gitignore index 4f17f7d..c671177 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/pyproject.toml b/pyproject.toml index c51c02e..99679b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/tox.ini b/tox.ini index cf70de9..e286479 100644 --- a/tox.ini +++ b/tox.ini @@ -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