barbican/tox.ini
Jeremy Liu c93fc17317 Fix coverage job
diff-cover compares HEAD with origin/master branch by default.
Zuul uses git operations to mirror the local prepared git repos
to the remote nodes. And all branch names are without 'origin',
so need to specify the branch name for coverage job.

Change-Id: Iaba21de10f6cf705e110cd60cb004502bb37515d
2018-02-09 08:15:22 +00:00

130 lines
4.1 KiB
INI

[tox]
minversion = 2.0
envlist = py35,py27,pep8,docs
skipsdist = True
[testenv]
usedevelop = True
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} -U {opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
oslo-config-generator --config-file etc/oslo-config-generator/barbican.conf --output-file etc/barbican/barbican.conf
/usr/bin/find . -type f -name "*.py[c|o]" -delete
rm -f .testrepository/times.dbm
coverage erase
python setup.py testr --coverage --testr-args='{posargs}'
coverage report -m
whitelist_externals = rm
[testenv:cover]
deps =
{[testenv]deps}
diff_cover
commands =
coverage erase
python setup.py testr --coverage --testr-args='{posargs}'
coverage xml
diff-cover --fail-under 100 --compare-branch master coverage.xml
[testenv:releasenotes]
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:pep8]
sitepackages = False
commands =
flake8 {posargs}
# Run security linter
bandit -r barbican -x tests -n5
[testenv:genconfig]
whitelist_externals = bash
commands =
oslo-config-generator --config-file etc/oslo-config-generator/barbican.conf
[testenv:venv]
commands = {posargs}
[testenv:debug]
commands = oslo_debug_helper {posargs}
[testenv:py3pep8]
# This hack is in place to allow us to run py3 based flake8
# without installing barbican.
basepython = python3
install_command = /bin/echo {packages}
commands =
pip install "hacking>=0.10.0,<0.11"
flake8 barbican setup.py
[testenv:docs]
commands=
rm -rf doc/build api-guide/build api-ref/build
python setup.py build_sphinx
sphinx-build -W -b html api-guide/source api-guide/build/html
sphinx-build -W -b html api-ref/source api-ref/build/html
whitelist_externals = rm
[testenv:api-guide]
# This environment is called from CI scripts to test and publish
# the API Guide to developer.openstack.org.
commands =
sphinx-build -W -b html -d api-guide/build/doctrees api-guide/source api-guide/build/html
[testenv:api-ref]
# This environment is called from CI scripts to test and publish
# the API Ref to developer.openstack.org.
commands =
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
[testenv:functional]
# This tox env is purely to make local test development easier
# Note: This requires local running instances of Barbican and Keystone
deps = -r{toxinidir}/test-requirements.txt
setenv = OS_TEST_PATH={toxinidir}/functionaltests
commands =
/usr/bin/find . -type f -name "*.py[c|o]" -delete
/bin/bash {toxinidir}/functionaltests/pretty_tox.sh '{posargs}'
passenv = KMIP_PLUGIN_ENABLED
[testenv:py35functional]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
setenv = OS_TEST_PATH={toxinidir}/functionaltests
commands =
/usr/bin/find . -type f -name "*.py[c|o]" -delete
/bin/bash {toxinidir}/functionaltests/pretty_tox.sh '{posargs}'
passenv = KMIP_PLUGIN_ENABLED
[testenv:cmd]
# This tox env is purely to make local test development easier
# Note: This requires local running instances of Barbican and Keystone
deps = -r{toxinidir}/test-requirements.txt
setenv = OS_TEST_PATH={toxinidir}/barbican/cmd/functionaltests
commands =
/usr/bin/find . -type f -name "*.py[c|o]" -delete
/bin/bash {toxinidir}/functionaltests/pretty_tox.sh '{posargs}'
[flake8]
exclude = .git,.idea,.tox,bin,dist,debian,rpmbuild,tools,*.egg-info,*.eggs,contrib,
*docs/target,*.egg,build
[testenv:bandit]
deps = -r{toxinidir}/test-requirements.txt
commands = bandit -r barbican -x tests -n5
[testenv:bindep]
# Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system
# dependencies are missing! This also means that bindep must be installed
# separately, outside of the requirements files.
deps = bindep
commands = bindep test
[testenv:genpolicy]
commands = oslopolicy-sample-generator --config-file=etc/oslo-config-generator/policy.conf
[hacking]
local-check-factory = barbican.hacking.checks.factory