1[tox]
2minversion = 3.18.0
3envlist = py3,pep8
4ignore_basepython_conflict = True
5skipsdist = True
6
7[testenv]
8usedevelop = True
9basepython = python3
10setenv =
11   VIRTUAL_ENV={envdir}
12   OS_TEST_PATH=./castellan/tests/unit
13deps =
14       -c{env:TOX_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
15       -r{toxinidir}/requirements.txt
16       -r{toxinidir}/test-requirements.txt
17commands = stestr run --slowest {posargs}
18
19[testenv:pep8]
20commands =
21  pre-commit run -a
22  bandit -r castellan -x tests -s B105,B106,B107,B607
23
24[testenv:bandit]
25# This command runs the bandit security linter against the castellan
26# codebase minus the tests directory. Some tests are being excluded to
27# reduce the number of positives before a team inspection, and to ensure a
28# passing gate job for initial addition. The excluded tests are:
29# B105-B107: hardcoded password checks - likely to generate false positives
30#            in a gate environment
31# B607: start process with a partial path - this should be a project level
32#       decision
33commands =
34  bandit -r castellan -x tests -s B105,B106,B107,B607
35
36[testenv:venv]
37commands = {posargs}
38
39[testenv:debug]
40commands = oslo_debug_helper {posargs}
41
42[testenv:cover]
43setenv =
44    PYTHON=coverage run --source castellan --parallel-mode
45commands =
46    coverage erase
47    {[testenv]commands}
48    coverage combine
49    coverage html -d cover
50    coverage xml -o cover/coverage.xml
51    coverage report --show-missing
52
53[testenv:docs]
54# This environment is called from CI scripts to test and publish
55# the main docs to https://docs.openstack.org/castellan
56description = Build main documentation
57deps = -r{toxinidir}/doc/requirements.txt
58commands=
59    rm -rf doc/build doc/build/doctrees
60    sphinx-build -W -b html -d doc/build/doctrees doc/source doc/build/html
61allowlist_externals = rm
62
63[testenv:pdf-docs]
64deps = {[testenv:docs]deps}
65envdir = {toxworkdir}/docs
66allowlist_externals =
67  rm
68  make
69commands =
70  rm -rf doc/build/pdf
71  sphinx-build -W -b latex doc/source doc/build/pdf
72  make -C doc/build/pdf
73
74[testenv:releasenotes]
75deps = {[testenv:docs]deps}
76envdir = {toxworkdir}/docs
77commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
78
79[testenv:functional]
80usedevelop = True
81setenv =
82    VIRTUAL_ENV={envdir}
83    OS_TEST_PATH=./castellan/tests/functional
84commands = stestr run --slowest {posargs}
85
86[testenv:functional-vault]
87passenv = HOME
88usedevelop = True
89setenv =
90    VIRTUAL_ENV={envdir}
91    OS_TEST_PATH=./castellan/tests/functional
92commands =
93    {toxinidir}/tools/setup-vault-env.sh pifpaf -e VAULT_TEST run vault -- stestr run --slowest {posargs}
94
95[testenv:genconfig]
96commands =
97    oslo-config-generator --config-file=etc/castellan/functional-config-generator.conf
98    oslo-config-generator --config-file=etc/castellan/sample-config-generator.conf
99
100[flake8]
101# [H106] Don't put vim configuration in source files.
102# [H203] Use assertIs(Not)None to check for None.
103show-source = True
104exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
105enable-extensions = H106,H203
106
107[hacking]
108import_exceptions = castellan.i18n
109
110[testenv:bindep]
111# Do not install any requirements. We want this to be fast and work even if
112# system dependencies are missing, since it's used to tell you what system
113# dependencies are missing! This also means that bindep must be installed
114# separately, outside of the requirements files, and develop mode disabled
115# explicitly to avoid unnecessarily installing the checked-out repo too (this
116# further relies on "tox.skipsdist = True" above).
117deps = bindep
118commands = bindep test
119usedevelop = False
120