diff --git a/.gitignore b/.gitignore index 09132e5f7..1f0139551 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ cover .tox nosetests.xml .testrepository +.stestr # Translations *.mo diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 000000000..d90a44466 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./shade/tests/unit +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 3ce7ec2a9..000000000 --- a/.testr.conf +++ /dev/null @@ -1,7 +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:-60} \ - ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./shade/tests/unit} $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/shade/tests/functional/hooks/post_test_hook.sh b/shade/tests/functional/hooks/post_test_hook.sh index 6be3fe42c..52037cd38 100755 --- a/shade/tests/functional/hooks/post_test_hook.sh +++ b/shade/tests/functional/hooks/post_test_hook.sh @@ -45,7 +45,7 @@ echo "Running shade functional test suite" set +e sudo -E -H -u jenkins tox -e$tox_env EXIT_CODE=$? -sudo testr last --subunit > $WORKSPACE/tempest.subunit +sudo stestr last --subunit > $WORKSPACE/tempest.subunit .tox/$tox_env/bin/pbr freeze set -e diff --git a/test-requirements.txt b/test-requirements.txt index e7edec71a..f726c02f2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -11,7 +11,7 @@ openstackdocstheme>=1.16.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 requests-mock>=1.1.0 # Apache-2.0 sphinx>=1.6.2 # BSD -testrepository>=0.0.18 # Apache-2.0/BSD +stestr>=1.0.0 # Apache-2.0 testscenarios>=0.4 # Apache-2.0/BSD testtools>=1.4.0 # MIT reno>=2.5.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index f6fd3f783..52a9274c1 100644 --- a/tox.ini +++ b/tox.ini @@ -9,31 +9,28 @@ basepython = {env:SHADE_TOX_PYTHON:python2} passenv = UPPER_CONSTRAINTS_FILE install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} setenv = - VIRTUAL_ENV={envdir} - LANG=en_US.UTF-8 - LANGUAGE=en_US:en - LC_ALL=C - BRANCH_NAME=master - CLIENT_NAME=shade + VIRTUAL_ENV={envdir} + LANG=en_US.UTF-8 + LANGUAGE=en_US:en + LC_ALL=C + BRANCH_NAME=master + CLIENT_NAME=shade deps = -r{toxinidir}/test-requirements.txt -commands = python setup.py testr --slowest --testr-args='{posargs}' +commands = stestr run {posargs} + stestr slowest [testenv:functional] -setenv = - {[testenv]setenv} - OS_TEST_PATH = ./shade/tests/functional passenv = OS_* SHADE_* UPPER_CONSTRAINTS_FILE -commands = python setup.py testr --slowest --testr-args='--concurrency=1 {posargs}' +commands = stestr --test-path ./shade/tests/functional run --serial {posargs} + stestr slowest [testenv:functional-tips] -setenv = - {[testenv]setenv} - OS_TEST_PATH = ./shade/tests/functional passenv = OS_* SHADE_* UPPER_CONSTRAINTS_FILE whitelist_externals = bash commands = - bash -x {toxinidir}/extras/install-tips.sh - python setup.py testr --slowest --testr-args='--concurrency=1 {posargs}' + bash -x {toxinidir}/extras/install-tips.sh + stestr --test-path ./shade/tests/functional run --serial {posargs} + stestr slowest [testenv:pep8] commands = flake8 shade @@ -44,11 +41,18 @@ commands = {posargs} [testenv:debug] whitelist_externals = find commands = - find . -type f -name "*.pyc" -delete - oslo_debug_helper {posargs} + find . -type f -name "*.pyc" -delete + oslo_debug_helper {posargs} [testenv:cover] -commands = python setup.py testr --coverage --testr-args='{posargs}' +setenv = + {[testenv]setenv} + PYTHON=coverage run --source shade --parallel-mode +commands = + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml [testenv:ansible] # Need to pass some env vars for the Ansible playbooks