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