1[tox]
2minversion = 3.18.0
3envlist = py3,pep8
4ignore_basepython_conflict = true
5
6[testenv]
7basepython = python3
8allowlist_externals =
9  env
10passenv =
11  OS_TEST_DBAPI_ADMIN_CONNECTION
12setenv =
13  BASECOMMAND=stestr run
14  {postgresql,all}: PIFPAF_POSTGRESQL=pifpaf -g OS_TEST_DBAPI_ADMIN_CONNECTION run postgresql --
15  {mysql,all}: PIFPAF_MYSQL=pifpaf -g OS_TEST_DBAPI_ADMIN_CONNECTION run mysql --
16  {mysql,postgresql,all}: BASECOMMAND={toxinidir}/tools/run-pifpaf-tests.sh
17# TODO(stephenfin): Remove once we bump our upper-constraint to SQLAlchemy 2.0
18  SQLALCHEMY_WARN_20=1
19deps =
20  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
21  -r{toxinidir}/test-requirements.txt
22  -r{toxinidir}/requirements.txt
23commands =
24  {env:PIFPAF_MYSQL:} {env:PIFPAF_POSTGRESQL:} {env:BASECOMMAND:} {posargs}
25
26[testenv:pep8]
27commands =
28  pre-commit run -a
29  # Run security linter
30  bandit -r oslo_db -x tests -n5 --skip B105,B311
31
32[testenv:venv]
33commands = {posargs}
34
35[testenv:cover]
36setenv =
37  PYTHON=coverage run --source oslo_db --parallel-mode
38commands =
39  stestr run {posargs}
40  coverage combine
41  coverage html -d cover
42  coverage xml -o cover/coverage.xml
43
44[testenv:docs]
45allowlist_externals =
46  rm
47deps =
48  {[testenv]deps}
49  -r{toxinidir}/doc/requirements.txt
50commands =
51  rm -rf doc/build doc/source/reference/api
52  doc8 -e .rst CONTRIBUTING.rst HACKING.rst README.rst doc/source
53  sphinx-build -W --keep-going -b html doc/source doc/build/html
54
55[testenv:releasenotes]
56allowlist_externals =
57  rm
58deps =
59  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
60  -r{toxinidir}/doc/requirements.txt
61commands =
62  rm -rf releasenotes/build
63  sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html
64
65[flake8]
66# E123, E125 skipped as they are invalid PEP-8.
67ignore = E123,E125,W504
68show-source = True
69exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
70
71[hacking]
72import_exceptions =
73  oslo_db._i18n
74
75[testenv:bindep]
76# Do not install any requirements. We want this to be fast and work even if
77# system dependencies are missing, since it's used to tell you what system
78# dependencies are missing! This also means that bindep must be installed
79# separately, outside of the requirements files, and develop mode disabled
80# explicitly to avoid unnecessarily installing the checked-out repo too (this
81# further relies on "tox.skipsdist = True" above).
82deps = bindep
83commands = bindep test
84usedevelop = False
85