diff --git a/.stestr.conf b/.stestr.conf index feb172371f65..f89d3980dd03 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/.testr.conf b/.testr.conf deleted file mode 100644 index 2e95b8305439..000000000000 --- a/.testr.conf +++ /dev/null @@ -1,18 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \ - ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./nova/tests} $LISTOPT $IDOPTION - -test_id_option=--load-list $IDFILE -test_list_option=--list -# NOTE(cdent): The group_regex describes how testrepository will -# group tests into the same process when running concurently. The -# following insures 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://testrepository.readthedocs.io/en/latest/MANUAL.html#grouping-tests -# https://gabbi.readthedocs.io/en/latest/#purpose -group_regex=nova\.tests\.functional\.api\.openstack\.placement\.test_placement_api(?:\.|_)([^_]+) diff --git a/test-requirements.txt b/test-requirements.txt index 7dd497f7920a..fe13d812dfcf 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/tests-functional-py3.txt b/tests-functional-py3.txt deleted file mode 100644 index 1a22c8d56fb9..000000000000 --- a/tests-functional-py3.txt +++ /dev/null @@ -1 +0,0 @@ -# All functional tests currently work with python 3.5. diff --git a/tools/pretty_tox3.sh b/tools/pretty_tox3.sh deleted file mode 100755 index ffc0e58f3674..000000000000 --- a/tools/pretty_tox3.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -TESTRARGS=$1 - -if [ $OS_TEST_PATH = './nova/tests/functional' ]; then - blacklist_file=tests-functional-py3.txt -else - blacklist_file=tests-py3.txt -fi - -if [ -z "$TESTRARGS" ]; then - stestr run --blacklist-file $blacklist_file -else - stestr run "$TESTRARGS" -fi diff --git a/tox.ini b/tox.ini index 19c5f8b286a1..c8556350b92c 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]