blob: fd93580e39761256efeab3cb8e5135c2c37cb772 [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
18# Linters
19[testenv:flake8]
20deps =
21 -rrequirements-dev-flake8.txt
22commands =
23 flake8 crashreports crashreport_stats hiccup
24
25[testenv:pylint]
26deps =
27 -rrequirements.txt
28 -rrequirements-dev-pylint.txt
29commands =
30 pylint crashreports crashreport_stats hiccup
31
32[testenv:linters]
33deps =
34 {[testenv:flake8]deps}
35 {[testenv:pylint]deps}
36commands =
37 {[testenv:flake8]commands}
38 {[testenv:pylint]commands}
39
Mitja Nikolausa054b832018-08-21 10:42:19 +020040# Git pre-commit hooks: Run formatter and linters
41[testenv:pre-commit-hooks]
42deps =
Mitja Nikolausbef34b92018-08-21 14:12:01 +020043 -rrequirements.txt
Mitja Nikolausa054b832018-08-21 10:42:19 +020044 -rrequirements-dev.txt
45passenv = GIT_INDEX_FILE
46commands =
47 {toxinidir}/tools/hooks/pre-commit.d/pre-commit-black.sh
48 python {toxinidir}/tools/hooks/pre-commit.d/pre-commit-flake8.py
Mitja Nikolausbef34b92018-08-21 14:12:01 +020049 {toxinidir}/tools/hooks/pre-commit.d/pre-commit-pylint.sh
Mitja Nikolausa054b832018-08-21 10:42:19 +020050
Borjan Tchakaloff7a70e552018-08-02 16:26:34 +020051# Flake8 configuration
52[flake8]
53format = ${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 +020054max-complexity = 10
Mitja Nikolaus959e2d62018-08-21 17:51:09 +020055max-line-length = 80
Mitja Nikolausd1995062018-07-30 14:10:27 +020056
57# Documentation
58# Shared commands for both docs options
59[docs]
60swagger_version = 1.3.3
61commands =
62 python manage.py generate_swagger --overwrite documentation/hiccup-api.json
63 wget -nc https://jcenter.bintray.com/io/github/swagger2markup/swagger2markup-cli/{[docs]swagger_version}/swagger2markup-cli-{[docs]swagger_version}.jar
64whitelist_externals=
65 java
66 wget
67
68# Create markdown docs
69[testenv:docs]
70deps = {[testenv]deps}
71commands =
72 {[docs]commands}
73 java -jar swagger2markup-cli-{[docs]swagger_version}.jar convert \
74 -f documentation/api-endpoints \
75 -i documentation/hiccup-api.json \
76 -c documentation/swagger.properties
77whitelist_externals = {[docs]whitelist_externals}
78
79# Create HTML docs
80[testenv:docs-html]
81deps = {[testenv]deps}
82commands =
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-asciidoc.properties
88 asciidoctor documentation/api-endpoints.adoc
89whitelist_externals =
90 {[docs]whitelist_externals}
91 asciidoctor