diff --git a/.stestr.conf b/.stestr.conf index feb172371..f89d3980d 100644 --- a/.stestr.conf +++ b/.stestr.conf @@ -1,4 +1,3 @@ [DEFAULT] -test_path=${OS_TEST_PATH:-./nova/tests} +test_path=./nova/tests/unit top_dir=./ -group_regex=nova\.tests\.functional\.api\.openstack\.placement\.test_placement_api(?:\.|_)([^_]+) diff --git a/test-requirements.txt b/test-requirements.txt index 7dd497f79..fe13d812d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -18,9 +18,8 @@ sphinxcontrib-actdiag>=0.8.5 # BSD sphinxcontrib-seqdiag>=0.8.4 # BSD os-api-ref>=1.4.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 -os-testr>=1.0.0 # Apache-2.0 +stestr>=1.0.0 # Apache-2.0 osprofiler>=1.4.0 # Apache-2.0 -testrepository>=0.0.18 # Apache-2.0/BSD testresources>=2.0.0 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT diff --git a/tox.ini b/tox.ini index 19c5f8b28..c8556350b 100644 --- a/tox.ini +++ b/tox.ini @@ -20,14 +20,11 @@ setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/test-requirements.txt commands = find . -type f -name "*.pyc" -delete - rm -Rf .testrepository/times.dbm passenv = OS_DEBUG GENERATE_HASHES # 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. [testenv:py27] -setenv = {[testenv]setenv} - OS_TEST_PATH=./nova/tests/unit commands = {[testenv]commands} stestr run '{posargs}' @@ -35,11 +32,9 @@ commands = stestr slowest [testenv:py35] -setenv = {[testenv]setenv} - OS_TEST_PATH=./nova/tests/unit commands = {[testenv]commands} - bash tools/pretty_tox3.sh '{posargs}' + stestr run --blacklist-file=tests-py3.txt '{posargs}' env TEST_OSPROFILER=1 stestr run --combine --no-discover 'nova.tests.unit.test_profiler' @@ -68,10 +63,17 @@ commands = basepython = python2.7 usedevelop = True setenv = {[testenv]setenv} - OS_TEST_PATH=./nova/tests/functional commands = {[testenv]commands} - stestr run '{posargs}' +# NOTE(cdent): The group_regex describes how stestr will group tests into the +# same process when running concurently. The following ensures that gabbi tests +# coming from the same YAML file are all in the same process. This is important +# because each YAML file represents an ordered sequence of HTTP requests. Note +# that tests which do not match this regex will not be grouped in any +# special way. See the following for more details. +# http://stestr.readthedocs.io/en/latest/MANUAL.html#grouping-tests +# https://gabbi.readthedocs.io/en/latest/#purpose + stestr --test-path=./nova/tests/functional --group-regex=nova\.tests\.functional\.api\.openstack\.placement\.test_placement_api(?:\.|_)([^_]+) run '{posargs}' stestr slowest # TODO(gcb) Merge this into [testenv:functional] when functional tests are gating @@ -80,20 +82,26 @@ commands = basepython = python3.5 usedevelop = True setenv = {[testenv]setenv} - OS_TEST_PATH=./nova/tests/functional commands = {[testenv]commands} - bash tools/pretty_tox3.sh '{posargs}' +# NOTE(cdent): The group_regex describes how stestr will group tests into the +# same process when running concurently. The following ensures that gabbi tests +# coming from the same YAML file are all in the same process. This is important +# because each YAML file represents an ordered sequence of HTTP requests. Note +# that tests which do not match this regex will not be grouped in any +# special way. See the following for more details. +# http://stestr.readthedocs.io/en/latest/MANUAL.html#grouping-tests +# https://gabbi.readthedocs.io/en/latest/#purpose + stestr --test-path=./nova/tests/functional --group-regex=nova\.tests\.functional\.api\.openstack\.placement\.test_placement_api(?:\.|_)([^_]+) run '{posargs}' [testenv:api-samples] usedevelop = True setenv = {[testenv]setenv} GENERATE_SAMPLES=True PYTHONHASHSEED=0 - OS_TEST_PATH=./nova/tests/functional/api_sample_tests commands = find . -type f -name "*.pyc" -delete - stestr run '{posargs}' + stestr --test-path=./nova/tests/functional/api_sample_tests run '{posargs}' stestr slowest [testenv:genconfig] @@ -105,10 +113,15 @@ commands = oslopolicy-sample-generator --config-file=etc/nova/nova-policy-genera [testenv:cover] # Also do not run test_coverage_ext tests while gathering coverage as those # tests conflict with coverage. +setenv = {[testenv]setenv} + PYTHON=coverage run --source nova --parallel-mode commands = coverage erase find . -type f -name "*.pyc" -delete - python setup.py testr --coverage --testr-args='{posargs}' + stestr run '{posargs}' + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml coverage report [testenv:debug]