diff options
Diffstat (limited to 'tox.ini')
-rw-r--r-- | tox.ini | 153 |
1 files changed, 73 insertions, 80 deletions
@@ -1,13 +1,8 @@ [tox] minversion = 3.18.0 -envlist = py39,functional,pep8 -# Automatic envs (pyXX) will only use the python version appropriate to that -# env and ignore basepython inherited from [testenv] if we set -# ignore_basepython_conflict. -ignore_basepython_conflict = True +envlist = py3,functional,pep8 [testenv] -basepython = python3 usedevelop = True allowlist_externals = bash @@ -15,6 +10,7 @@ allowlist_externals = rm env make +install_command = python -I -m pip install -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {opts} {packages} setenv = VIRTUAL_ENV={envdir} LANGUAGE=en_US @@ -26,11 +22,19 @@ setenv = # TODO(stephenfin): Remove once we bump our upper-constraint to SQLAlchemy 2.0 SQLALCHEMY_WARN_20=1 deps = - -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} - -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt +extras = + zvm + hyperv + vmware passenv = - OS_DEBUG GENERATE_HASHES + OS_DEBUG + GENERATE_HASHES +# NOTE(sean-k-mooney) optimization is enabled by default and when enabled +# asserts are complied out. Disable optimization to allow asserts in +# nova to fire in unit and functional tests. This can be useful for +# debugging issue with fixtures and mocks. + PYTHONOPTIMIZE # there is also secret magic in subunit-trace which lets you run in a fail only # mode. To do this define the TRACE_FAILONLY environmental variable. commands = @@ -38,20 +42,57 @@ commands = env TEST_OSPROFILER=1 stestr run --combine --no-discover 'nova.tests.unit.test_profiler' stestr slowest +[testenv:functional{,-py38,-py39,-py310,-py311}] +description = + Run functional tests. +# As nova functional tests import the PlacementFixture from the placement +# repository these tests are, by default, set up to run with openstack-placement +# from pypi. In the gate, Zuul will use the installed version of placement (stable +# branch version on stable gate run) OR the version of placement the Depends-On in +# the commit message suggests. If you want to run the tests with latest master from +# the placement repo, modify the dep line to point at master, example: +# deps = +# {[testenv]deps} +# git+https://opendev.org/openstack/placement#egg=openstack-placement +# If you want to run the test locally with an un-merged placement change, +# modify the dep line to point to your dependency or pip install placement +# into the appropriate tox virtualenv. +# NOTE: We express the requirement here instead of test-requirements +# because we do not want placement present during unit tests. +deps = + {[testenv]deps} + openstack-placement>=9.0.0.0b1 +extras = +commands = + stestr --test-path=./nova/tests/functional run {posargs} + stestr slowest + +[testenv:functional-without-sample-db-tests] +description = + Run functional tests by excluding the API|Notification + sample tests and DB tests. This env is used in + placement-nova-tox-functional-py38 job which is defined and + run in placement. +deps = {[testenv:functional]deps} +extras = +commands = + stestr --test-path=./nova/tests/functional run --exclude-regex '((?:api|notification)_sample_tests|functional\.db\.)' {posargs} + [testenv:mypy] description = Run type checks. envdir = {toxworkdir}/shared +extras = commands = bash tools/mypywrap.sh {posargs} [testenv:pep8] description = Run style checks. -envdir = {toxworkdir}/shared deps = {[testenv]deps} autopep8 +extras = commands = {[testenv:mypy]commands} # check if autopep8 would alter the formatting but don't actually change it @@ -68,6 +109,7 @@ commands = bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python' [testenv:autopep8] +extras = deps = autopep8 commands = autopep8 --exit-code --max-line-length=79 --in-place -r nova doc setup.py @@ -76,6 +118,7 @@ commands = description = Run style checks on the changes made since HEAD~. For a full run including docs, use 'pep8' envdir = {toxworkdir}/shared +extras = commands = bash tools/flake8wrap.sh -HEAD @@ -84,72 +127,11 @@ description = Determine whether a backport is ready to be merged by checking whether it has already been merged to master or more recent stable branches. deps = +extras = skipsdist = true commands = bash tools/check-cherry-picks.sh -[testenv:functional] -description = - Run functional tests using python3. -# As nova functional tests import the PlacementFixture from the placement -# repository these tests are, by default, set up to run with openstack-placement -# from pypi. In the gate, Zuul will use the installed version of placement (stable -# branch version on stable gate run) OR the version of placement the Depends-On in -# the commit message suggests. If you want to run the tests with latest master from -# the placement repo, modify the dep line to point at master, example: -# deps = -# {[testenv]deps} -# git+https://opendev.org/openstack/placement#egg=openstack-placement -# If you want to run the test locally with an un-merged placement change, -# modify the dep line to point to your dependency or pip install placement -# into the appropriate tox virtualenv. -# NOTE: We express the requirement here instead of test-requirements -# because we do not want placement present during unit tests. -deps = - {[testenv]deps} - openstack-placement>=1.0.0 -commands = - stestr --test-path=./nova/tests/functional run {posargs} - stestr slowest - -[testenv:functional-py36] -description = - Run functional tests using python3.6. -deps = {[testenv:functional]deps} -commands = - {[testenv:functional]commands} - -[testenv:functional-py37] -description = - Run functional tests using python3.7. -deps = {[testenv:functional]deps} -commands = - {[testenv:functional]commands} - -[testenv:functional-py38] -description = - Run functional tests using python3.8. -deps = {[testenv:functional]deps} -commands = - {[testenv:functional]commands} - -[testenv:functional-without-sample-db-tests] -description = - Run functional tests by excluding the API|Notification - sample tests and DB tests. This env is used in - placement-nova-tox-functional-py38 job which is defined and - run in placement. -deps = {[testenv:functional]deps} -commands = - stestr --test-path=./nova/tests/functional run --exclude-regex '((?:api|notification)_sample_tests|functional\.db\.)' {posargs} - -[testenv:functional-py39] -description = - Run functional tests using python3.9. -deps = {[testenv:functional]deps} -commands = - {[testenv:functional]commands} - [testenv:api-samples] envdir = {toxworkdir}/functional setenv = @@ -157,17 +139,20 @@ setenv = GENERATE_SAMPLES=True PYTHONHASHSEED=0 deps = {[testenv:functional]deps} +extras = commands = stestr --test-path=./nova/tests/functional/api_sample_tests run {posargs} stestr slowest [testenv:genconfig] envdir = {toxworkdir}/shared +extras = commands = oslo-config-generator --config-file=etc/nova/nova-config-generator.conf [testenv:genpolicy] envdir = {toxworkdir}/shared +extras = commands = oslopolicy-sample-generator --config-file=etc/nova/nova-policy-generator.conf @@ -180,6 +165,7 @@ envdir = {toxworkdir}/shared setenv = {[testenv]setenv} PYTHON=coverage run --source nova --parallel-mode +extras = commands = coverage erase stestr run {posargs} @@ -190,6 +176,7 @@ commands = [testenv:debug] envdir = {toxworkdir}/shared +extras = commands = oslo_debug_helper {posargs} @@ -197,6 +184,7 @@ commands = deps = {[testenv]deps} -r{toxinidir}/doc/requirements.txt +extras = commands = {posargs} @@ -207,7 +195,9 @@ description = # to install (test-)requirements.txt for docs. deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/requirements.txt -r{toxinidir}/doc/requirements.txt +extras = commands = rm -rf doc/build/html doc/build/doctrees sphinx-build -W --keep-going -b html -j auto doc/source doc/build/html @@ -219,6 +209,7 @@ description = Build PDF documentation. envdir = {toxworkdir}/docs deps = {[testenv:docs]deps} +extras = commands = rm -rf doc/build/pdf sphinx-build -W --keep-going -b latex -j auto doc/source doc/build/pdf @@ -229,6 +220,7 @@ description = Generate the API guide. Called from CI scripts to test and publish to docs.openstack.org. envdir = {toxworkdir}/docs deps = {[testenv:docs]deps} +extras = commands = rm -rf api-guide/build sphinx-build -W --keep-going -b html -j auto api-guide/source api-guide/build/html @@ -238,6 +230,7 @@ description = Generate the API ref. Called from CI scripts to test and publish to docs.openstack.org. envdir = {toxworkdir}/docs deps = {[testenv:docs]deps} +extras = commands = rm -rf api-ref/build sphinx-build -W --keep-going -b html -j auto api-ref/source api-ref/build/html @@ -247,6 +240,7 @@ description = Generate release notes. envdir = {toxworkdir}/docs deps = {[testenv:docs]deps} +extras = commands = rm -rf releasenotes/build sphinx-build -W --keep-going -b html -j auto releasenotes/source releasenotes/build/html @@ -256,6 +250,7 @@ description = Build all documentation including API guides and refs. envdir = {toxworkdir}/docs deps = {[testenv:docs]deps} +extras = commands = {[testenv:docs]commands} {[testenv:api-guide]commands} @@ -266,6 +261,7 @@ commands = # NOTE(browne): This is required for the integration test job of the bandit # project. Please do not remove. envdir = {toxworkdir}/shared +extras = commands = bandit -r nova -x tests -n 5 -ll [flake8] @@ -294,7 +290,7 @@ exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,releasenotes # to 25 and run 'tox -epep8'. # 39 is currently the most complex thing we have # TODO(jogo): get this number down to 25 or so -max-complexity=40 +max-complexity = 40 [hacking] import_exceptions = typing,nova.i18n @@ -347,6 +343,9 @@ extension = N367 = checks:do_not_alias_mock_class N368 = checks:do_not_use_mock_class_as_new_mock_value N369 = checks:check_lockutils_rwlocks + N370 = checks:check_six + N371 = checks:import_stock_mock + N372 = checks:check_set_daemon paths = ./nova/hacking @@ -358,12 +357,6 @@ paths = # explicitly to avoid unnecessarily installing the checked-out repo too usedevelop = False deps = bindep +extras = commands = bindep test - -[testenv:lower-constraints] -usedevelop = False -deps = - -c{toxinidir}/lower-constraints.txt - -r{toxinidir}/test-requirements.txt - -r{toxinidir}/requirements.txt |