blob: 5092cac4470732c7e015711f478b944672436454 [file] [log] [blame]
# tox (https://tox.readthedocs.io/) 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 = py36
[testenv]
commands =
python manage.py test {posargs}
# Test coverage
[testenv:coverage]
deps =
coverage
commands =
coverage run manage.py test
coverage report
# Test coverage with html report
[testenv:coverage-html]
deps =
{[testenv:coverage]deps}
commands =
{[testenv:coverage]commands}
coverage html
# Linters
[linters]
include_dirs = crashreports crashreport_stats hiccup
[testenv:flake8]
deps =
-rrequirements-dev-flake8.txt
commands =
flake8 {posargs: {[linters]include_dirs}}
[testenv:pylint]
deps =
-rrequirements-dev-pylint.txt
commands =
pylint {posargs: {[linters]include_dirs}}
[testenv:linters]
deps =
{[testenv:flake8]deps}
{[testenv:pylint]deps}
commands =
{[testenv:flake8]commands}
{[testenv:pylint]commands}
# Git pre-commit hooks: Run formatter and linters
[testenv:pre-commit-hooks]
deps =
-rrequirements-dev.txt
passenv = GIT_INDEX_FILE
commands =
{toxinidir}/tools/hooks/pre-commit.d/pre-commit-black.sh
python {toxinidir}/tools/hooks/pre-commit.d/pre-commit-flake8.py
{toxinidir}/tools/hooks/pre-commit.d/pre-commit-pylint.sh
# Flake8 configuration
[flake8]
format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s
max-complexity = 10
max-line-length = 80
# Documentation
# Shared commands for both docs options
[docs]
swagger_version = 1.3.3
commands =
python manage.py generate_swagger --overwrite documentation/hiccup-api.json
wget -nc https://jcenter.bintray.com/io/github/swagger2markup/swagger2markup-cli/{[docs]swagger_version}/swagger2markup-cli-{[docs]swagger_version}.jar
whitelist_externals=
java
wget
# Create markdown docs
[testenv:docs]
commands =
{[docs]commands}
java -jar swagger2markup-cli-{[docs]swagger_version}.jar convert \
-f documentation/api-endpoints \
-i documentation/hiccup-api.json \
-c documentation/swagger.properties
whitelist_externals = {[docs]whitelist_externals}
# Create HTML docs
[testenv:docs-html]
commands =
{[docs]commands}
java -jar swagger2markup-cli-{[docs]swagger_version}.jar convert \
-f documentation/api-endpoints \
-i documentation/hiccup-api.json \
-c documentation/swagger-asciidoc.properties
asciidoctor documentation/api-endpoints.adoc
whitelist_externals =
{[docs]whitelist_externals}
asciidoctor