Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 1 | # 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 Nikolaus | a054b83 | 2018-08-21 10:42:19 +0200 | [diff] [blame] | 7 | envlist = py36 |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 8 | |
| 9 | [testenv] |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 10 | commands = |
Franz-Xaver Geiger | 2a0de3d | 2018-09-19 10:27:04 +0200 | [diff] [blame] | 11 | python manage.py test {posargs} |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 12 | |
Mitja Nikolaus | 940c035 | 2018-08-29 12:31:57 +0200 | [diff] [blame] | 13 | # Test coverage |
| 14 | [testenv:coverage] |
| 15 | deps = |
Mitja Nikolaus | 940c035 | 2018-08-29 12:31:57 +0200 | [diff] [blame] | 16 | coverage |
| 17 | commands = |
| 18 | coverage run manage.py test |
| 19 | coverage report |
| 20 | |
| 21 | # Test coverage with html report |
| 22 | [testenv:coverage-html] |
| 23 | deps = |
| 24 | {[testenv:coverage]deps} |
| 25 | commands = |
| 26 | {[testenv:coverage]commands} |
| 27 | coverage html |
| 28 | |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 29 | # Linters |
Franz-Xaver Geiger | 2a0de3d | 2018-09-19 10:27:04 +0200 | [diff] [blame] | 30 | [linters] |
| 31 | include_dirs = crashreports crashreport_stats hiccup |
| 32 | |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 33 | [testenv:flake8] |
| 34 | deps = |
| 35 | -rrequirements-dev-flake8.txt |
| 36 | commands = |
Franz-Xaver Geiger | 2a0de3d | 2018-09-19 10:27:04 +0200 | [diff] [blame] | 37 | flake8 {posargs: {[linters]include_dirs}} |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 38 | |
| 39 | [testenv:pylint] |
| 40 | deps = |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 41 | -rrequirements-dev-pylint.txt |
| 42 | commands = |
Franz-Xaver Geiger | 2a0de3d | 2018-09-19 10:27:04 +0200 | [diff] [blame] | 43 | pylint {posargs: {[linters]include_dirs}} |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 44 | |
| 45 | [testenv:linters] |
| 46 | deps = |
| 47 | {[testenv:flake8]deps} |
| 48 | {[testenv:pylint]deps} |
| 49 | commands = |
| 50 | {[testenv:flake8]commands} |
| 51 | {[testenv:pylint]commands} |
| 52 | |
Mitja Nikolaus | a054b83 | 2018-08-21 10:42:19 +0200 | [diff] [blame] | 53 | # Git pre-commit hooks: Run formatter and linters |
| 54 | [testenv:pre-commit-hooks] |
| 55 | deps = |
| 56 | -rrequirements-dev.txt |
| 57 | passenv = GIT_INDEX_FILE |
| 58 | commands = |
| 59 | {toxinidir}/tools/hooks/pre-commit.d/pre-commit-black.sh |
| 60 | python {toxinidir}/tools/hooks/pre-commit.d/pre-commit-flake8.py |
Mitja Nikolaus | bef34b9 | 2018-08-21 14:12:01 +0200 | [diff] [blame] | 61 | {toxinidir}/tools/hooks/pre-commit.d/pre-commit-pylint.sh |
Mitja Nikolaus | a054b83 | 2018-08-21 10:42:19 +0200 | [diff] [blame] | 62 | |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 63 | # Flake8 configuration |
| 64 | [flake8] |
| 65 | format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 66 | max-complexity = 10 |
Mitja Nikolaus | 959e2d6 | 2018-08-21 17:51:09 +0200 | [diff] [blame] | 67 | max-line-length = 80 |
Mitja Nikolaus | d199506 | 2018-07-30 14:10:27 +0200 | [diff] [blame] | 68 | |
| 69 | # Documentation |
| 70 | # Shared commands for both docs options |
| 71 | [docs] |
| 72 | swagger_version = 1.3.3 |
| 73 | commands = |
| 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 |
| 76 | whitelist_externals= |
| 77 | java |
| 78 | wget |
| 79 | |
| 80 | # Create markdown docs |
| 81 | [testenv:docs] |
Mitja Nikolaus | d199506 | 2018-07-30 14:10:27 +0200 | [diff] [blame] | 82 | commands = |
| 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 |
| 88 | whitelist_externals = {[docs]whitelist_externals} |
| 89 | |
| 90 | # Create HTML docs |
| 91 | [testenv:docs-html] |
Mitja Nikolaus | d199506 | 2018-07-30 14:10:27 +0200 | [diff] [blame] | 92 | commands = |
| 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 |
| 99 | whitelist_externals = |
| 100 | {[docs]whitelist_externals} |
| 101 | asciidoctor |