forked from Uninett/nav
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
131 lines (116 loc) · 4.53 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
122
123
124
125
126
127
128
129
130
131
# -*- 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{39,310}-django{32}
javascript
docs
skipsdist = True
basepython = python3.9
[pytest]
addopts = --failed-first
markers =
twisted: marks tests as needing twisted async to run
[gh-actions]
python =
3.9: py39
3.10: py310
[testenv]
# Baseline test environment
deps =
pip
-r tests/requirements.txt
-r requirements/base.txt
-r requirements/optional.txt
-r requirements/django{env:DJANGO_VER}.txt
-c constraints.txt
setenv =
LC_ALL=C.UTF-8
LANG=C.UTF-8
PYTHONPATH = {toxinidir}/tests
VIRTUALENV_PIP=23.1.0
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 =
C_INCLUDE_PATH
GITHUB_ACTIONS
GITHUB_RUN_ID
USER
PGHOST
PGPORT
PGDATABASE
PGUSER
PGPASSWORD
WORKSPACE
DISPLAY
DYLD_LIBRARY_PATH
LD_LIBRARY_PATH
allowlist_externals =
sh
sed
mkdir
chmod
make
usedevelop = true
commands_pre =
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}: make sassbuild
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: 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}
[testenv:javascript]
usedevelop=True
allowlist_externals = xvfb-run
commands_pre =
commands =
xvfb-run {toxinidir}/tests/javascript-test.sh "{toxinidir}"
[testenv:pylint]
deps = pip-tools
description = PyLint run on default environment
setenv =
PYLINTHOME = {toxinidir}
LC_ALL=C.UTF-8
LANG=C.UTF-8
VIRTUALENV_PIP=23.1.0
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 =
-r doc/requirements.txt
usedevelop = true
setenv =
PYTHONPATH = {toxinidir}/python:{toxinidir}/tests
DJANGO_SETTINGS_MODULE = nav.django.settings
LC_ALL=C.UTF-8
LANG=C.UTF-8
VIRTUALENV_PIP=23.1.0
allowlist_externals = sh
commands_pre =
commands =
sphinx-build doc/ doc/_build/
sh -c "cd doc; python -c 'import conf; print(conf.version)' > {toxinidir}/reports/doc_version"