drydock/tox.ini

99 lines
2.7 KiB
INI

[tox]
envlist = py38,pep8,bandit
setupdir=python/
[testenv]
setenv = YAMLDIR = {toxinidir}/python/tests/yaml_samples/
passenv = http_proxy,HTTP_PROXY,https_proxy,HTTPS_PROXY,no_proxy,NO_PROXY
deps=
-r{toxinidir}/python/requirements-lock.txt
[testenv:venv]
commands = {posargs}
[testenv:freeze]
recreate = True
allowlist_externals=
rm
sh
pipdeptree
deps=
-rpython/requirements-direct.txt
-rpython/requirements-test.txt
commands=
rm -f python/requirements-lock.txt
sh -c "pip freeze --all | grep -vE 'drydock-provisioner|pyinotify|pkg-resources==0.0.0' > python/requirements-lock.txt"
sh -c "pipdeptree > python/requirements-tree.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:py38]
usedevelop=True
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
setenv=
PYTHONWARNING=all
YAMLDIR={toxinidir}/python/tests/yaml_samples/
commands=
{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
setenv=
YAMLDIR={toxinidir}/python/tests/yaml_samples/
commands=
{toxinidir}/python/tests/postgres/start_postgres.sh
py.test --cov=drydock_provisioner \
{toxinidir}/python/tests/unit/ {toxinidir}/python/tests/integration/postgres
[testenv:genconfig]
allowlist_externals=tee
sh
commands = 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 = 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}
[testenv:bandit]
commands = bandit -r drydock_provisioner -n 5
[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