From 4db7cda136bbbc93f1c278c17bdd8b63af3b17d7 Mon Sep 17 00:00:00 2001 From: Matthew Edmonds Date: Fri, 29 Jun 2018 17:44:41 -0400 Subject: [PATCH] Move to stestr Follows nova's lead in moving from os-testr to stestr. Change-Id: I048165d659d9cb194ee27072729076647dfc0710 --- .gitignore | 2 +- .stestr.conf | 3 +++ .testr.conf | 7 ------- test-requirements.txt | 3 +-- tools/pretty_tox.sh | 16 ---------------- tox.ini | 42 +++++++++++++++++++++++++++++++++++++++--- 6 files changed, 44 insertions(+), 29 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf delete mode 100755 tools/pretty_tox.sh diff --git a/.gitignore b/.gitignore index 2728ac17..0aa7aa64 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ build/* -.testrepository +.stestr/ .tox/ nova_powervm.egg-info/ *.pyc diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 00000000..85535f45 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./nova_powervm/tests +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index fb622677..00000000 --- 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 ./ . $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list \ No newline at end of file diff --git a/test-requirements.txt b/test-requirements.txt index d6153377..04df3b47 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,8 +8,7 @@ fixtures>=3.0.0 # Apache-2.0/BSD python-subunit>=1.0.0 # Apache-2.0/BSD python-swiftclient>=3.2.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0 -os-testr>=1.0.0 # Apache-2.0 -testrepository>=0.0.18 # Apache-2.0/BSD +stestr>=1.0.0 # Apache-2.0 testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT mock>=2.0.0 # BSD diff --git a/tools/pretty_tox.sh b/tools/pretty_tox.sh deleted file mode 100755 index 799ac184..00000000 --- a/tools/pretty_tox.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail - -TESTRARGS=$1 - -# --until-failure is not compatible with --subunit see: -# -# https://bugs.launchpad.net/testrepository/+bug/1411804 -# -# this work around exists until that is addressed -if [[ "$TESTARGS" =~ "until-failure" ]]; then - python setup.py testr --slowest --testr-args="$TESTRARGS" -else - python setup.py testr --slowest --testr-args="--subunit $TESTRARGS" | subunit-trace -f -fi diff --git a/tox.ini b/tox.ini index 6e56adab..2a39a100 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,12 @@ skipsdist = True usedevelop = True install_command = pip install {opts} {packages} setenv = - VIRTUAL_ENV={envdir} + VIRTUAL_ENV={envdir} + LANGUAGE=en_US + LC_ALL=en_US.utf-8 + OS_STDOUT_CAPTURE=1 + OS_STDERR_CAPTURE=1 + OS_TEST_TIMEOUT=60 deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} -r{toxinidir}/requirements.txt @@ -15,7 +20,24 @@ deps = -egit+https://git.openstack.org/openstack/nova#egg=nova -rhttps://git.openstack.org/cgit/openstack/nova/plain/test-requirements.txt whitelist_externals = bash -commands = bash tools/pretty_tox.sh '{posargs}' +commands = + find . -type f -name "*.pyc" -delete + +[testenv:py27] +# TODO(efried): Remove this once https://github.com/tox-dev/tox/issues/425 is fixed. +basepython = python2.7 +commands = + {[testenv]commands} + stestr run {posargs} + stestr slowest + +[testenv:py35] +# TODO(efried): Remove this once https://github.com/tox-dev/tox/issues/425 is fixed. +basepython = python3.5 +commands = + {[testenv]commands} + stestr run {posargs} + stestr slowest [testenv:pep8] basepython = python3 @@ -27,7 +49,21 @@ commands = {posargs} [testenv:cover] basepython = python3 -commands = python setup.py testr --coverage --testr-args='{posargs}' +# TODO(stephenfin): Remove the PYTHON hack below in favour of a [coverage] +# section once we rely on coverage 4.3+ +# +# https://bitbucket.org/ned/coveragepy/issues/519/ +setenv = + {[testenv]setenv} + PYTHON=coverage run --source nova --parallel-mode +commands = + {[testenv]commands} + coverage erase + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml + coverage report [testenv:docs] basepython = python3