blob: 6d5975b2f7590169925e6cbca8775724d74b7f60 [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# There is no proper way to install the app for now (i.e. setup.py)
9skipsdist = True
10
11[testenv]
12deps =
13 -rrequirements.txt
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +020014commands =
15 python manage.py test
16
Mitja Nikolaus940c0352018-08-29 12:31:57 +020017# Test coverage
18[testenv:coverage]
19deps =
20 {[testenv]deps}
21 coverage
22commands =
23 coverage run manage.py test
24 coverage report
25
26# Test coverage with html report
27[testenv:coverage-html]
28deps =
29 {[testenv:coverage]deps}
30commands =
31 {[testenv:coverage]commands}
32 coverage html
33
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +020034# Linters
35[testenv:flake8]
36deps =
37 -rrequirements-dev-flake8.txt
38commands =
39 flake8 crashreports crashreport_stats hiccup
40
41[testenv:pylint]
42deps =
43 -rrequirements.txt
44 -rrequirements-dev-pylint.txt
45commands =
46 pylint crashreports crashreport_stats hiccup
47
48[testenv:linters]
49deps =
50 {[testenv:flake8]deps}
51 {[testenv:pylint]deps}
52commands =
53 {[testenv:flake8]commands}
54 {[testenv:pylint]commands}
55
Mitja Nikolausa054b832018-08-21 10:42:19 +020056# Git pre-commit hooks: Run formatter and linters
57[testenv:pre-commit-hooks]
58deps =
Mitja Nikolausbef34b92018-08-21 14:12:01 +020059 -rrequirements.txt
Mitja Nikolausa054b832018-08-21 10:42:19 +020060 -rrequirements-dev.txt
61passenv = GIT_INDEX_FILE
62commands =
63 {toxinidir}/tools/hooks/pre-commit.d/pre-commit-black.sh
64 python {toxinidir}/tools/hooks/pre-commit.d/pre-commit-flake8.py
Mitja Nikolausbef34b92018-08-21 14:12:01 +020065 {toxinidir}/tools/hooks/pre-commit.d/pre-commit-pylint.sh
Mitja Nikolausa054b832018-08-21 10:42:19 +020066
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +020067# Flake8 configuration
68[flake8]
69format = ${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 +020070max-complexity = 10
Mitja Nikolaus959e2d62018-08-21 17:51:09 +020071max-line-length = 80
Mitja Nikolausd1995062018-07-30 14:10:27 +020072
73# Documentation
74# Shared commands for both docs options
75[docs]
76swagger_version = 1.3.3
77commands =
78 python manage.py generate_swagger --overwrite documentation/hiccup-api.json
79 wget -nc https://jcenter.bintray.com/io/github/swagger2markup/swagger2markup-cli/{[docs]swagger_version}/swagger2markup-cli-{[docs]swagger_version}.jar
80whitelist_externals=
81 java
82 wget
83
84# Create markdown docs
85[testenv:docs]
86deps = {[testenv]deps}
87commands =
88 {[docs]commands}
89 java -jar swagger2markup-cli-{[docs]swagger_version}.jar convert \
90 -f documentation/api-endpoints \
91 -i documentation/hiccup-api.json \
92 -c documentation/swagger.properties
93whitelist_externals = {[docs]whitelist_externals}
94
95# Create HTML docs
96[testenv:docs-html]
97deps = {[testenv]deps}
98commands =
99 {[docs]commands}
100 java -jar swagger2markup-cli-{[docs]swagger_version}.jar convert \
101 -f documentation/api-endpoints \
102 -i documentation/hiccup-api.json \
103 -c documentation/swagger-asciidoc.properties
104 asciidoctor documentation/api-endpoints.adoc
105whitelist_externals =
106 {[docs]whitelist_externals}
107 asciidoctor