deb-cinder/tox.ini
Kendall Nelson 2f9e4163f4 Downstream Fix for Genconfig
This patch adds the opts.py file to the tree as a fix for deployers
that package cinder. The opts.py file is no longer being deleted right
away by generate_sample.sh after the cinder.sample.conf is being
generated.

This patch also introduces a pep8 check to make sure that the opts.py
file is up to date, so that it will catch when new opts get added to
Cinder without the opts.py being updated.

To support the ability to keep and check the opts file a number
of changes were needed in the check_uptodate.sh script as well as
the generate_sample.sh script:
    - check_uptodate now takes --checkopts instead of --checkonly
      When checkopts is used the opts.py file is generated using the
      current code and the generated file is compared to the existing
      file.  The check fails if there are differences.
    - generate_sample now has the --nosamplefile option.
      When this option is used, only the opts.py file is generated.
      The oslo-config-generator code is skipped so no sample file
      is created.
    - generate_sample also has some coding style consistency changes.
    - Added the 'genopts' option to tox so users can generate
      a fresh opts.py without a sample file when necessary.

Closes-Bug: 1501820
Co-Author: Jay Bryant <jsbryant@us.ibm.com>

Change-Id: I1f5494ebb19d5f4e8c651cbeef0acad07ad96829
2015-11-13 12:36:21 -06:00

144 lines
4.3 KiB
INI

[tox]
minversion = 1.8
skipsdist = True
envlist = py27,pep8
[testenv]
# Note the hash seed is set to 0 until cinder can be tested with a
# random hash seed successfully.
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
usedevelop = True
install_command =
constraints: {[testenv:common-constraints]install_command}
pip install {opts} {packages}
# TODO(mriedem): Move oslo.versionedobjects[fixtures] to test-requirements.txt
# after I937823ffeb95725f0b55e298ebee1857d6482883 lands.
deps = -r{toxinidir}/test-requirements.txt
oslo.versionedobjects[fixtures]
# By default ostestr will set concurrency
# to ncpu, to specify something else use
# the concurrency=<n> option.
# call ie: 'tox -epy27 -- --concurrency=4'
commands = ostestr {posargs}
whitelist_externals = bash
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[tox:jenkins]
downloadcache = ~/cache/pip
[testenv:releasenotes]
commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:common-constraints]
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
[testenv:py34]
commands =
ostestr --whitelist_file=tests-py3.txt
[testenv:py34-constraints]
install_command = {[testenv:common-constraints]install_command}
commands = {[testenv:py34]commands}
[testenv:pep8]
commands =
flake8 {posargs} . cinder/common
# Check that .po and .pot files are valid:
bash -c "find cinder -type f -regex '.*\.pot?' -print0|xargs -0 -n 1 msgfmt --check-format -o /dev/null"
{toxinidir}/tools/config/check_uptodate.sh
{toxinidir}/tools/check_exec.py {toxinidir}/cinder
[testenv:pep8-constraints]
install_command = {[testenv:common-constraints]install_command}
commands =
flake8 {posargs} . cinder/common
# Check that .po and .pot files are valid:
bash -c "find cinder -type f -regex '.*\.pot?' -print0|xargs -0 -n 1 msgfmt --check-format -o /dev/null"
{toxinidir}/tools/config/check_uptodate.sh --checkopts
{toxinidir}/tools/config/check_uptodate.sh
{toxinidir}/tools/check_exec.py {toxinidir}/cinder
[testenv:fast8]
# Use same environment directory as pep8 env to save space and install time
envdir = {toxworkdir}/pep8
commands =
{toxinidir}/tools/fast8.sh
[testenv:pylint]
deps = -r{toxinidir}/requirements.txt
pylint==0.26.0
commands = bash tools/lintstack.sh
[testenv:pylint-constraints]
install_command = {[testenv:common-constraints]install_command}
deps = {[testenv:pylint]deps}
commands = {[testenv:pylint]commands}
[testenv:cover]
# Also do not run test_coverage_ext tests while gathering coverage as those
# tests conflict with coverage.
commands =
python setup.py testr --coverage \
--testr-args='^(?!.*test.*coverage).*$'
[testenv:cover-constraints]
install_command = {[testenv:common-constraints]install_command}
commands = {[testenv:cover]commands}
[testenv:genconfig]
sitepackages = False
envdir = {toxworkdir}/venv
commands = {toxinidir}/tools/config/generate_sample.sh from_tox
[testenv:genopts]
sitepackages = False
envdir = {toxworkdir}/venv
commands = {toxinidir}/tools/config/generate_sample.sh from_tox --nosamplefile
[testenv:venv]
commands = {posargs}
[testenv:venv-constraints]
install_command = {[testenv:common-constraints]install_command}
commands = {posargs}
[testenv:docs]
commands = python setup.py build_sphinx
[testenv:gendriverlist]
sitepackages = False
envdir = {toxworkdir}/venv
commands = python {toxinidir}/tools/generate_driver_list.py
[testenv:bandit]
deps = -r{toxinidir}/test-requirements.txt
commands = bandit -c tools/bandit.yaml -r cinder -n 5 -ll
[flake8]
# Following checks are ignored on purpose.
#
# E251 unexpected spaces around keyword / parameter equals
# reason: no improvement in readability
#
# Due to the upgrade to hacking 0.9.2 the following checking are
# ignored on purpose for the moment and should be re-enabled.
#
# H405
# Due to the upgrade to hacking 0.10.0 the following checking are
# ignored on purpose for the moment and should be cleaned up and re-enabled.
#
# H105 Don't use author tags
#
ignore = E251,H105
exclude = .git,.venv,.tox,dist,tools,doc,common,*egg,build
max-complexity=30
[hacking]
local-check-factory = cinder.hacking.checks.factory
import_exceptions = cinder.i18n