blob: 5092cac4470732c7e015711f478b944672436454 [file] [log] [blame]
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +02001# tox (https://tox.readthedocs.io/) is a tool for running tests
2# in multiple virtualenvs. This configuration file will run the
3# test suite on all supported python versions. To use it, "pip install tox"
4# and then run "tox" from this directory.
5
6[tox]
Mitja Nikolausa054b832018-08-21 10:42:19 +02007envlist = py36
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +02008
9[testenv]
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +020010commands =
Franz-Xaver Geiger2a0de3d2018-09-19 10:27:04 +020011 python manage.py test {posargs}
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +020012
Mitja Nikolaus940c0352018-08-29 12:31:57 +020013# Test coverage
14[testenv:coverage]
15deps =
Mitja Nikolaus940c0352018-08-29 12:31:57 +020016 coverage
17commands =
18 coverage run manage.py test
19 coverage report
20
21# Test coverage with html report
22[testenv:coverage-html]
23deps =
24 {[testenv:coverage]deps}
25commands =
26 {[testenv:coverage]commands}
27 coverage html
28
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +020029# Linters
Franz-Xaver Geiger2a0de3d2018-09-19 10:27:04 +020030[linters]
31include_dirs = crashreports crashreport_stats hiccup
32
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +020033[testenv:flake8]
34deps =
35 -rrequirements-dev-flake8.txt
36commands =
Franz-Xaver Geiger2a0de3d2018-09-19 10:27:04 +020037 flake8 {posargs: {[linters]include_dirs}}
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +020038
39[testenv:pylint]
40deps =
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +020041 -rrequirements-dev-pylint.txt
42commands =
Franz-Xaver Geiger2a0de3d2018-09-19 10:27:04 +020043 pylint {posargs: {[linters]include_dirs}}
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +020044
45[testenv:linters]
46deps =
47 {[testenv:flake8]deps}
48 {[testenv:pylint]deps}
49commands =
50 {[testenv:flake8]commands}
51 {[testenv:pylint]commands}
52
Mitja Nikolausa054b832018-08-21 10:42:19 +020053# Git pre-commit hooks: Run formatter and linters
54[testenv:pre-commit-hooks]
55deps =
56 -rrequirements-dev.txt
57passenv = GIT_INDEX_FILE
58commands =
59 {toxinidir}/tools/hooks/pre-commit.d/pre-commit-black.sh
60 python {toxinidir}/tools/hooks/pre-commit.d/pre-commit-flake8.py
Mitja Nikolausbef34b92018-08-21 14:12:01 +020061 {toxinidir}/tools/hooks/pre-commit.d/pre-commit-pylint.sh
Mitja Nikolausa054b832018-08-21 10:42:19 +020062
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +020063# Flake8 configuration
64[flake8]
65format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +020066max-complexity = 10
Mitja Nikolaus959e2d62018-08-21 17:51:09 +020067max-line-length = 80
Mitja Nikolausd1995062018-07-30 14:10:27 +020068
69# Documentation
70# Shared commands for both docs options
71[docs]
72swagger_version = 1.3.3
73commands =
74 python manage.py generate_swagger --overwrite documentation/hiccup-api.json
75 wget -nc https://jcenter.bintray.com/io/github/swagger2markup/swagger2markup-cli/{[docs]swagger_version}/swagger2markup-cli-{[docs]swagger_version}.jar
76whitelist_externals=
77 java
78 wget
79
80# Create markdown docs
81[testenv:docs]
Mitja Nikolausd1995062018-07-30 14:10:27 +020082commands =
83 {[docs]commands}
84 java -jar swagger2markup-cli-{[docs]swagger_version}.jar convert \
85 -f documentation/api-endpoints \
86 -i documentation/hiccup-api.json \
87 -c documentation/swagger.properties
88whitelist_externals = {[docs]whitelist_externals}
89
90# Create HTML docs
91[testenv:docs-html]
Mitja Nikolausd1995062018-07-30 14:10:27 +020092commands =
93 {[docs]commands}
94 java -jar swagger2markup-cli-{[docs]swagger_version}.jar convert \
95 -f documentation/api-endpoints \
96 -i documentation/hiccup-api.json \
97 -c documentation/swagger-asciidoc.properties
98 asciidoctor documentation/api-endpoints.adoc
99whitelist_externals =
100 {[docs]whitelist_externals}
101 asciidoctor