144 lines
3.3 KiB
INI
144 lines
3.3 KiB
INI
[tox]
|
|
envlist = py310,pep8,bandit
|
|
setupdir=python/
|
|
minversion = 3.28.0
|
|
|
|
[testenv]
|
|
setenv = YAMLDIR = {toxinidir}/python/tests/yaml_samples/
|
|
passenv =
|
|
http_proxy
|
|
HTTP_PROXY
|
|
https_proxy
|
|
HTTPS_PROXY
|
|
no_proxy
|
|
NO_PROXY
|
|
DOCKER_REGISTRY
|
|
IMAGE_NAME
|
|
IMAGE_PREFIX
|
|
IMAGE_TAG
|
|
DISTRO
|
|
deps=
|
|
-r{toxinidir}/python/requirements-frozen.txt
|
|
-r{toxinidir}/python/test-requirements.txt
|
|
|
|
[testenv:venv]
|
|
commands = {posargs}
|
|
|
|
[testenv:freeze]
|
|
recreate = True
|
|
allowlist_externals=
|
|
rm
|
|
sh
|
|
deps=
|
|
-r{toxinidir}/python/requirements-direct.txt
|
|
-c https://raw.githubusercontent.com/apache/airflow/constraints-3.0.2/constraints-3.10.txt
|
|
commands=
|
|
rm -f python/requirements-frozen.txt
|
|
sh -c "pip freeze --all | grep -vE 'drydock_provisioner|pyinotify|pkg-resources==0.0.0' > python/requirements-frozen.txt"
|
|
|
|
[testenv:yapf]
|
|
allowlist_externals=find
|
|
commands=
|
|
yapf -i -r --style=pep8 {toxinidir}/python/setup.py
|
|
yapf -i -r --style=pep8 {toxinidir}/alembic
|
|
yapf -i -r --style=pep8 {toxinidir}/python/drydock_provisioner
|
|
yapf -i -r --style=pep8 {toxinidir}/python/tests
|
|
find {toxinidir}/python/drydock_provisioner -name '__init__.py' -exec yapf -i --style=pep8 \{\} ;
|
|
|
|
[testenv:py310]
|
|
usedevelop=True
|
|
allowlist_externals=
|
|
py.test
|
|
setenv=
|
|
PYTHONWARNING=all
|
|
YAMLDIR={toxinidir}/python/tests/yaml_samples/
|
|
commands=
|
|
py.test \
|
|
--cov=drydock_provisioner \
|
|
{toxinidir}/python/tests/unit/{posargs}
|
|
|
|
[testenv:integration]
|
|
passenv =
|
|
DOCKER_REGISTRY
|
|
IMAGE_NAME
|
|
IMAGE_PREFIX
|
|
IMAGE_TAG
|
|
DISTRO
|
|
setenv=
|
|
PYTHONWARNING=all
|
|
YAMLDIR={toxinidir}/python/tests/yaml_samples/
|
|
allowlist_externals=
|
|
sh
|
|
pip3
|
|
py.test
|
|
commands=
|
|
pip3 install ./python/ --use-pep517
|
|
sh -c {toxinidir}/python/tests/postgres/start_postgres.sh
|
|
py.test \
|
|
{toxinidir}/python/tests/integration/postgres/{posargs}
|
|
|
|
[testenv:cover]
|
|
usedevelop=True
|
|
passenv =
|
|
DOCKER_REGISTRY
|
|
IMAGE_NAME
|
|
IMAGE_PREFIX
|
|
IMAGE_TAG
|
|
DISTRO
|
|
setenv=
|
|
YAMLDIR={toxinidir}/python/tests/yaml_samples/
|
|
allowlist_externals=
|
|
sh
|
|
env
|
|
commands=
|
|
env
|
|
sh -c {toxinidir}/python/tests/postgres/start_postgres.sh
|
|
py.test \
|
|
--cov=drydock_provisioner \
|
|
--cov-report html:cover \
|
|
--cov-report xml:cover/coverage.xml \
|
|
--cov-report term \
|
|
--cov-fail-under 49 \
|
|
{toxinidir}/python/tests/unit/ \
|
|
{toxinidir}/python/tests/integration/postgres
|
|
|
|
|
|
[testenv:genconfig]
|
|
allowlist_externals =
|
|
tee
|
|
sh
|
|
commands =
|
|
pip3 install ./python/ --use-pep517
|
|
sh -c 'oslo-config-generator --config-file=etc/drydock/drydock-config-generator.conf | tee etc/drydock/drydock.conf.sample doc/source/_static/drydock.conf.sample'
|
|
|
|
[testenv:genpolicy]
|
|
allowlist_externals =
|
|
tee
|
|
sh
|
|
commands =
|
|
pip3 install ./python/ --use-pep517
|
|
sh -c 'oslopolicy-sample-generator --config-file etc/drydock/drydock-policy-generator.conf | tee etc/drydock/policy.yaml.sample doc/source/_static/policy.yaml.sample'
|
|
|
|
[testenv:pep8]
|
|
commands =
|
|
flake8 {posargs}
|
|
bandit -r ./python/drydock_provisioner -n 5 --skip B303
|
|
|
|
[testenv:bandit]
|
|
commands = bandit -r ./python/drydock_provisioner -n 5 --skip B303
|
|
|
|
[flake8]
|
|
ignore=E302,H306,H304,W503,E251,E126
|
|
exclude= venv,.venv,.git,.idea,.tox,*.egg-info,*.eggs,bin,dist,./build/,alembic/
|
|
max-line-length=119
|
|
|
|
[testenv:docs]
|
|
deps=
|
|
-rdoc/requirements-doc.txt
|
|
-epython
|
|
allowlist_externals=rm
|
|
recreate=true
|
|
commands =
|
|
rm -rf doc/build
|
|
sphinx-build -b html doc/source doc/build/html
|