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 | # There is no proper way to install the app for now (i.e. setup.py) |
| 9 | skipsdist = True |
| 10 | |
| 11 | [testenv] |
| 12 | deps = |
| 13 | -rrequirements.txt |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 14 | commands = |
Franz-Xaver Geiger | 2a0de3d | 2018-09-19 10:27:04 +0200 | [diff] [blame] | 15 | python manage.py test {posargs} |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 16 | |
Mitja Nikolaus | 940c035 | 2018-08-29 12:31:57 +0200 | [diff] [blame] | 17 | # Test coverage |
| 18 | [testenv:coverage] |
| 19 | deps = |
| 20 | {[testenv]deps} |
| 21 | coverage |
| 22 | commands = |
| 23 | coverage run manage.py test |
| 24 | coverage report |
| 25 | |
| 26 | # Test coverage with html report |
| 27 | [testenv:coverage-html] |
| 28 | deps = |
| 29 | {[testenv:coverage]deps} |
| 30 | commands = |
| 31 | {[testenv:coverage]commands} |
| 32 | coverage html |
| 33 | |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 34 | # Linters |
Franz-Xaver Geiger | 2a0de3d | 2018-09-19 10:27:04 +0200 | [diff] [blame] | 35 | [linters] |
| 36 | include_dirs = crashreports crashreport_stats hiccup |
| 37 | |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 38 | [testenv:flake8] |
| 39 | deps = |
| 40 | -rrequirements-dev-flake8.txt |
| 41 | commands = |
Franz-Xaver Geiger | 2a0de3d | 2018-09-19 10:27:04 +0200 | [diff] [blame] | 42 | flake8 {posargs: {[linters]include_dirs}} |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 43 | |
| 44 | [testenv:pylint] |
| 45 | deps = |
| 46 | -rrequirements.txt |
| 47 | -rrequirements-dev-pylint.txt |
| 48 | commands = |
Franz-Xaver Geiger | 2a0de3d | 2018-09-19 10:27:04 +0200 | [diff] [blame] | 49 | pylint {posargs: {[linters]include_dirs}} |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 50 | |
| 51 | [testenv:linters] |
| 52 | deps = |
| 53 | {[testenv:flake8]deps} |
| 54 | {[testenv:pylint]deps} |
| 55 | commands = |
| 56 | {[testenv:flake8]commands} |
| 57 | {[testenv:pylint]commands} |
| 58 | |
Mitja Nikolaus | a054b83 | 2018-08-21 10:42:19 +0200 | [diff] [blame] | 59 | # Git pre-commit hooks: Run formatter and linters |
| 60 | [testenv:pre-commit-hooks] |
| 61 | deps = |
Mitja Nikolaus | bef34b9 | 2018-08-21 14:12:01 +0200 | [diff] [blame] | 62 | -rrequirements.txt |
Mitja Nikolaus | a054b83 | 2018-08-21 10:42:19 +0200 | [diff] [blame] | 63 | -rrequirements-dev.txt |
| 64 | passenv = GIT_INDEX_FILE |
| 65 | commands = |
| 66 | {toxinidir}/tools/hooks/pre-commit.d/pre-commit-black.sh |
| 67 | python {toxinidir}/tools/hooks/pre-commit.d/pre-commit-flake8.py |
Mitja Nikolaus | bef34b9 | 2018-08-21 14:12:01 +0200 | [diff] [blame] | 68 | {toxinidir}/tools/hooks/pre-commit.d/pre-commit-pylint.sh |
Mitja Nikolaus | a054b83 | 2018-08-21 10:42:19 +0200 | [diff] [blame] | 69 | |
Borjan Tchakaloff | 7a70e55 | 2018-08-02 16:26:34 +0200 | [diff] [blame] | 70 | # Flake8 configuration |
| 71 | [flake8] |
| 72 | 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] | 73 | max-complexity = 10 |
Mitja Nikolaus | 959e2d6 | 2018-08-21 17:51:09 +0200 | [diff] [blame] | 74 | max-line-length = 80 |
Mitja Nikolaus | d199506 | 2018-07-30 14:10:27 +0200 | [diff] [blame] | 75 | |
| 76 | # Documentation |
| 77 | # Shared commands for both docs options |
| 78 | [docs] |
| 79 | swagger_version = 1.3.3 |
| 80 | commands = |
| 81 | python manage.py generate_swagger --overwrite documentation/hiccup-api.json |
| 82 | wget -nc https://jcenter.bintray.com/io/github/swagger2markup/swagger2markup-cli/{[docs]swagger_version}/swagger2markup-cli-{[docs]swagger_version}.jar |
| 83 | whitelist_externals= |
| 84 | java |
| 85 | wget |
| 86 | |
| 87 | # Create markdown docs |
| 88 | [testenv:docs] |
| 89 | deps = {[testenv]deps} |
| 90 | commands = |
| 91 | {[docs]commands} |
| 92 | java -jar swagger2markup-cli-{[docs]swagger_version}.jar convert \ |
| 93 | -f documentation/api-endpoints \ |
| 94 | -i documentation/hiccup-api.json \ |
| 95 | -c documentation/swagger.properties |
| 96 | whitelist_externals = {[docs]whitelist_externals} |
| 97 | |
| 98 | # Create HTML docs |
| 99 | [testenv:docs-html] |
| 100 | deps = {[testenv]deps} |
| 101 | commands = |
| 102 | {[docs]commands} |
| 103 | java -jar swagger2markup-cli-{[docs]swagger_version}.jar convert \ |
| 104 | -f documentation/api-endpoints \ |
| 105 | -i documentation/hiccup-api.json \ |
| 106 | -c documentation/swagger-asciidoc.properties |
| 107 | asciidoctor documentation/api-endpoints.adoc |
| 108 | whitelist_externals = |
| 109 | {[docs]whitelist_externals} |
| 110 | asciidoctor |