-
Notifications
You must be signed in to change notification settings - Fork 3
/
tox.ini
121 lines (107 loc) · 5.42 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# -*- indent-tabs-mode: nil; -*-
#
# This tox configuration is mainly meant for running inside a Docker container,
# based on tests/docker/Dockerfile
# When changing the python or django version also change it in the tox example
# of the documentation in hacking.rst
[tox]
envlist = {unit,integration,functional}-py{37,38,39}-django{32}, javascript, docs
skipsdist = True
basepython = python3.7
[pytest]
addopts = --failed-first
markers =
twisted: marks tests as needing twisted async to run
[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
[testenv]
# Baseline test environment
deps =
pip-tools
pip
setenv =
LC_ALL=C.UTF-8
LANG=C.UTF-8
PYTHONPATH = {toxinidir}/tests
BUILDDIR = {envdir}
CHROME_BIN = /usr/bin/google-chrome
DJANGO_SETTINGS_MODULE = nav.django.settings
COVERAGE_FILE = {toxinidir}/reports/coverage/.coverage
PYTHONFAULTHANDLER=1
django32: DJANGO_VER=32
django40: DJANGO_VER=40
passenv = GITHUB_ACTIONS GITHUB_RUN_ID USER PGHOST PGPORT PGDATABASE PGUSER PGPASSWORD WORKSPACE DISPLAY
allowlist_externals =
sh
sed
mkdir
chmod
commands_pre =
pip-compile --resolver=backtracking --output-file {envdir}/requirements.txt tests/requirements.txt requirements/base.txt requirements/optional.txt requirements/django{env:DJANGO_VER}.txt
pip-sync {envdir}/requirements.txt
pip install -e .
mkdir -p {toxinidir}/reports/coverage
chmod 777 {toxinidir}/reports/coverage
commands =
unit: pytest -o junit_suite_name="{envname} unit tests" --cov-config {toxinidir}/tests/.coveragerc --cov={toxinidir}/python --cov-report=xml:reports/{envname}/coverage.xml --junitxml=reports/{envname}/unit-results.xml --verbose {posargs:tests/unittests}
{integration,functional}: python setup.py build_sass
integration: python -m nav.django.manage check
{integration,functional}: nav config install {envdir}/etc
{integration,functional}: mkdir -p {envdir}/uploads
{integration,functional}: sed -i 's,^#\?UPLOAD_DIR.*.,UPLOAD_DIR={envdir}/uploads,' {envdir}/etc/nav.conf
integration: sed -i 's/^#DJANGO_DEBUG.*/DJANGO_DEBUG=True/' {envdir}/etc/nav.conf
integration: sed -i 's/^NAV_USER.*/NAV_USER={env:USER}/' {envdir}/etc/nav.conf
integration: sed -i 's,^#base.*,base=http://localhost:9000,' {envdir}/etc/graphite.conf
integration: django-admin collectstatic --noinput
integration: pytest -o junit_suite_name="{envname} integration tests" --cov-config {toxinidir}/tests/.coveragerc --cov={toxinidir}/python --cov-report=xml:reports/{envname}/coverage.xml --html reports/{envname}/integration-report.html --junitxml=reports/{envname}/integration-results.xml --verbose --showlocals {posargs:tests/integration}
functional: sed -i 's/^nav.*=.*INFO/root=DEBUG/' {envdir}/etc/logging.conf
functional: /sbin/start-stop-daemon -o --stop --quiet --pidfile /var/tmp/xvfb.pid
functional: /sbin/start-stop-daemon --start --quiet --pidfile /var/tmp/xvfb.pid --make-pidfile --background --exec /usr/bin/Xvfb -- {env:DISPLAY} -screen 0 1024x768x24 -fbdir /var/tmp -ac
functional: django-admin collectstatic --noinput
functional: pytest -o junit_suite_name="{envname} functional tests" --junitxml=reports/{envname}/functional-results.xml --verbose --driver Chrome --driver-path=/usr/local/bin/chromedriver --sensitive-url "nothing to see here" --html reports/{envname}/functional-report.html {posargs:tests/functional}
functional: /sbin/start-stop-daemon --stop --quiet --pidfile /var/tmp/xvfb.pid
[testenv:javascript]
usedevelop=True
deps = libsass==0.15.1
commands_pre =
commands =
/sbin/start-stop-daemon -o --stop --quiet --pidfile /var/tmp/xvfb.pid
/sbin/start-stop-daemon --start --quiet --pidfile /var/tmp/xvfb.pid --make-pidfile --background --exec /usr/bin/Xvfb -- {env:DISPLAY} -screen 0 1024x768x24 -fbdir /var/tmp -ac
{toxinidir}/tests/javascript-test.sh "{toxinidir}"
/sbin/start-stop-daemon --stop --quiet --pidfile /var/tmp/xvfb.pid
[testenv:pylint]
deps = pip-tools
description = PyLint run on default environment
setenv =
PYLINTHOME = {toxinidir}
LC_ALL=C.UTF-8
LANG=C.UTF-8
commands_pre =
pip-compile --resolver=backtracking --output-file {envdir}/requirements.txt tests/requirements.txt requirements/base.txt requirements/django32.txt
pip-sync {envdir}/requirements.txt
commands =
{toxinidir}/tests/docker/scripts/pylint.sh python/nav --jobs=4 --rcfile=python/pylint.rc --disable=I,similarities --load-plugins pylint_django --output-format=parseable
[testenv:docs]
description = Just build the Sphinx documentation
deps = pip-tools
setenv =
PYTHONPATH = {toxinidir}/python:{toxinidir}/tests
DJANGO_SETTINGS_MODULE = nav.django.settings
LC_ALL=C.UTF-8
LANG=C.UTF-8
allowlist_externals = sh
commands_pre =
pip-compile --resolver=backtracking --output-file {envdir}/requirements.txt doc/requirements.txt
pip-sync {envdir}/requirements.txt
commands =
python setup.py build_sphinx
sh -c "cd doc; python -c 'import conf; print(conf.version)' > {toxinidir}/reports/doc_version"
# The flake8 setup should mirror the setup in pre-commit
[flake8]
statistics = True
count = True
# Only check for critical problems that will prevent testing/running
select = E9,F63,F7,F82