137 lines
3.8 KiB
INI
Raw Normal View History

[tox]
envlist = py27,py36,pep8,apiexamples,cover,api-ref,releasenotes,bandit,fakemodetests,pylint
minversion = 2.0
skipsdist = True
[testenv]
setenv = VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
Fix gate issues Issue 1: The os-testr 1.0.0 release had a couple of required config changes due to it's internal usage of stestr. This change to stestr changed the way tests were discovered by os-testr and as a result the unit test run was picking up tempest tests. A regex is added to the py3base environment call of ostestr because the use of --serial and --blacklist-file together is broken in stestr and adding the regex parameter allows the blacklist-file to be processed. The stestr issue is documented here [1]. Issue 2: Cache dirs for PKI tokens have been removed for all services in devstack under I5680376e70e74882e9fdb87ee1b95d5f40570ad7. We must also remove the use here to pass the right parameters to configure_auth_token_middleware. Issue 3: Keystone V2 APIs have been removed. When creating Nova and Glance clients, the test code was either hard coding v2 Keystone or not providing enough information for the V3 auth. Issue 4: Oslo context has deprecated parameters such as 'tenant', has removed them from its constructor and is using a rename decorator to handle them. As such, the code and test case to check for unrecognized parameters to TroveContext and Context is erroneously removing the tenant parameter. Oslo context has also changed the from_dict method since the original code to remove parameters was introduced into Trove. The new method signature and code should already provide most or all of the protections against incompatibility the original code was attempting to provide. The fix for this issue is to change TroveContext's from_dict method to use the kwargs to handle its own __init__ parameters and be more in line with what Nova is doing in its RequestContext subclass. Issue 5: Jobs run as jenkins on Zuul v2 but run as user zuul on Zuul v3. Issue 6: Ignore one case of pylint E1101 in the Ceilometer notification code base. [1] https://github.com/mtreinish/stestr/issues/103 Change-Id: Ic55187b0d73d4c572d7f8332882b4f455a6177c8
2017-09-25 07:49:32 -05:00
OS_TEST_PATH=./trove/tests/unittests
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
usedevelop = True
install_command = pip install \
-c{env:TEST_UPPER_CONSTRAINTS_FILE:{toxinidir}/test-upper-constraints.txt} \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} \
-U {opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = find ./trove -type f -name "*.pyc" -delete
rm -f trove_test.sqlite
stestr run --serial {posargs}
stestr slowest
whitelist_externals = find
rm
bash
[tox:jenkins]
sitepackages = True
[testenv:pep8]
basepython = python3
commands =
flake8
doc8 {posargs}
[testenv:apiexamples]
basepython = python3
commands = {envpython} generate_examples.py
[testenv:fakemodetests]
basepython = python3
commands = {envpython} run_tests.py
[testenv:debug]
basepython = python3
commands = oslo_debug_helper {posargs}
[testenv:cover]
basepython = python3
setenv =
{[testenv]setenv}
PYTHON=coverage run --source trove
commands =
coverage erase
stestr run --serial {posargs}
coverage run -a run_tests.py
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:venv]
basepython = python3
commands = {posargs}
[doc8]
ignore-path = .venv,.tox,.git,dist,doc,*egg-info,tools,etc,build,*.po,*.pot,integration,releasenotes,*.txt,api-ref/source/samples
[flake8]
show-source = True
# H301 is ignored on purpose.
# The rest of the ignores are TODOs.
ignore = F821,H301,H404,H405,H501,E402,W503,E731
enable-extensions = H203,H106
builtins = _
# add *.yaml for playbooks/trove-devstack-base.yaml, as it will be matched by
# trove-* in the "filename" configuration.
exclude=.venv,.tox,.git,dist,doc,*egg,tools,etc,build,*.po,*.pot,integration,releasenotes,*.yaml
filename=*.py,trove-*,app.wsgi
Add translation_checks for i18n This is the first patch to enable the translation checks. These translation checks were taken from neutron_lib/hacking Translation checks include: * validate_log_translation: Translate log messages * no_translate_debug_logs: Don't transate debug level logs * check_raised_localization_exception: Translate exception message The pep8 tests will fail until all files meet the standards enforced by these translaiton checks. So this patch is depenedent on the following: Depends-On: Ieb7e006de497c974756941608aea91f63e860dc5 Depends-On: I1d0649f240365b7f62b13af6edb1e8dbb5d06597 Depends-On: I48f95b3c090e9b6f91185c14113daae5bc621d0b Depends-On: I5feafe8945960e34a8d0e038ad4617f39502f19b Depends-On: If29f7b5df7f6958cec4b26f72babc47ca70f3706 Depends-On: Iddd738c2d9a7c9a57fcd445650d087123dbccfc4 Depends-On: Ifdf426684473fb05cae63877c334e6cf65aa5234 Depends-On: I94a341ba1fb4178e0c358c37ea31623d48938ec6 Depends-On: Ic8664bf105d601909c6efa5cf73db6c27adaf42e Depends-On: I80f2ea6a20944cfbfdc79a8a71ad744f23aeaac1 Depends-On: If68b38ef5bdeba2fdc28f94d964ef8ce6d15c352 Depends-On: Ia54014fa8e44aacc7935bd73c1ee8d3139a19735 Depends-On: Iea58f4df337c79785dc7afe0e31bcfa7e231f374 Depends-On: I2b0313021fd9599bdaeb375358e8cf834581d493 Depends-On: I56972d16634654b8b71853d6aba10299cc9e2418 Depends-On: If632727fd29ec8d36c6890ebd156a46be70ba783 Depends-On: I1df8d4cba6a3a2ec23e8a1b2aa4ffc03c97b149e Depends-On: I4070117b6335f4d85f35cc6473653c17d7c14bac Depends-On: I83f2ccd623588af3fc5f94334b753cebcc3b6c18 Depends-On: I44ac13e9431018e18980e8ff7ff442c7fea68a13 Depends-On: I88284f61b5f37d78ad050a97c679f6bde23d832d Depends-On: I6fb2bdcc4b83457e08b24599fb4a297ef6ec6c14 Change-Id: Ia2844799a2af8e020470d4c513ad55a51ec36ce1
2016-12-05 11:41:47 -06:00
[hacking]
import_exceptions = trove.common.i18n
local-check-factory = trove.hacking.checks.factory
Add translation_checks for i18n This is the first patch to enable the translation checks. These translation checks were taken from neutron_lib/hacking Translation checks include: * validate_log_translation: Translate log messages * no_translate_debug_logs: Don't transate debug level logs * check_raised_localization_exception: Translate exception message The pep8 tests will fail until all files meet the standards enforced by these translaiton checks. So this patch is depenedent on the following: Depends-On: Ieb7e006de497c974756941608aea91f63e860dc5 Depends-On: I1d0649f240365b7f62b13af6edb1e8dbb5d06597 Depends-On: I48f95b3c090e9b6f91185c14113daae5bc621d0b Depends-On: I5feafe8945960e34a8d0e038ad4617f39502f19b Depends-On: If29f7b5df7f6958cec4b26f72babc47ca70f3706 Depends-On: Iddd738c2d9a7c9a57fcd445650d087123dbccfc4 Depends-On: Ifdf426684473fb05cae63877c334e6cf65aa5234 Depends-On: I94a341ba1fb4178e0c358c37ea31623d48938ec6 Depends-On: Ic8664bf105d601909c6efa5cf73db6c27adaf42e Depends-On: I80f2ea6a20944cfbfdc79a8a71ad744f23aeaac1 Depends-On: If68b38ef5bdeba2fdc28f94d964ef8ce6d15c352 Depends-On: Ia54014fa8e44aacc7935bd73c1ee8d3139a19735 Depends-On: Iea58f4df337c79785dc7afe0e31bcfa7e231f374 Depends-On: I2b0313021fd9599bdaeb375358e8cf834581d493 Depends-On: I56972d16634654b8b71853d6aba10299cc9e2418 Depends-On: If632727fd29ec8d36c6890ebd156a46be70ba783 Depends-On: I1df8d4cba6a3a2ec23e8a1b2aa4ffc03c97b149e Depends-On: I4070117b6335f4d85f35cc6473653c17d7c14bac Depends-On: I83f2ccd623588af3fc5f94334b753cebcc3b6c18 Depends-On: I44ac13e9431018e18980e8ff7ff442c7fea68a13 Depends-On: I88284f61b5f37d78ad050a97c679f6bde23d832d Depends-On: I6fb2bdcc4b83457e08b24599fb4a297ef6ec6c14 Change-Id: Ia2844799a2af8e020470d4c513ad55a51ec36ce1
2016-12-05 11:41:47 -06:00
[testenv:api-ref]
basepython = python3
# This environment is called from CI scripts to test and publish
# the API Ref to developer.openstack.org.
commands =
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
[testenv:releasenotes]
basepython = python3
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:bandit]
basepython = python3
commands = bandit -r trove -n5 -x tests
[testenv:bandit-baseline]
basepython = python3
envdir = {toxworkdir}/bandit
commands = bandit-baseline -r trove -n5 -x tests -ii -ll
[testenv:genpolicy]
basepython = python3
commands = oslopolicy-sample-generator --config-file=tools/trove-policy-generator.conf
[testenv:pylint]
basepython = python3
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = python tools/trove-pylint.py {posargs:check}
improve pylint; generate errors and config in sorted order Since the config is not in a deterministic order makes it hard to compare two config's and see what changed. Personally, I'm not positive I understand this use-case; i.e. you have an existing config file, you save it, and then rebuild and then diff the two files. I'd have thought you'd just run check and the output of the tool was the diff. I however do see the value in sorting the file so that when someone submits a change that includes a change to the config, reviewers can see more easily what the change is doing. Similarly, the output from pylint (errors) are generated one file at a time and os.walk makes no guarantee of deterministic order. So we should collect all errors (across all files) and then print an ordered list for human consumption. The intent is also to make pylint voting soon (in master). the changes to contributing.rst and tox.ini are to make that easier. The config file has also been sorted in place. This change was motivated by an email exchange with Peter so I am marking him as a co-conspirator. The line numbers were removed from the tools/trove-pylint.config file as these would change whenever the line numbers in the file changed (since they are currently not being used in the comparison; they can be re-added if deemed necessary at the cost of having every 'rebuild' run create a different file). The tools/trove-pylint.config was regenerated as well, since the remaining two errors seem to be innocuous: ERROR: trove/taskmanager/manager.py 392: E1101 no-member, Manager.upgrade: Instance of 'BuiltInstance' has no 'upgrade' member (new method introduced by instance upgrade; other BuiltInstance member errors are already ignored.) and ERROR: trove/guestagent/datastore/experimental/postgresql/service/ access.py 80: E1101 no-member, PgSqlAccess.list_access: Instance ofi 'PgSqlAccess' has no '_find_user' member (this is due to the fact that PostgreSQL is spread over multiple files and pylint should cease to complain once https://review.openstack.org/#/c/346082/ lands.) Change-Id: I910c738d3845b7749e57910f76523150ec5a5bff Closes-Bug: #1625158 Closes-Bug: #1625245 Co-Authored-By: Peter Stachowski <peter@tesora.com>
2016-09-19 08:26:24 -04:00
[testenv:docs]
basepython = python3
commands = sphinx-build -W -b html doc/source doc/build/html
[testenv:lower-constraints]
basepython = python3
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
[testenv:trovestack]
basepython = python3
skip_install = True
changedir = {toxinidir}/integration/scripts
passenv = *
commands =
pip install --no-binary :all: {toxinidir} \
-c/opt/stack/trove/test-upper-constraints.txt \
-chttps://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt
./trovestack {posargs}