From a90ede0d6c13788f1edcafc81d3f0fcb6e188655 Mon Sep 17 00:00:00 2001 From: Vu Cong Tuan Date: Thu, 12 Jul 2018 16:08:44 +0700 Subject: [PATCH] Switch to stestr According to Openstack summit session [1], stestr is maintained project to which all Openstack projects should migrate. Let's switch to stestr as other projects have already moved to it. [1] https://etherpad.openstack.org/p/YVR-python-pti Change-Id: I9a52c912ef5ad19fe24e9294f573a2770436d5e3 --- .gitignore | 2 +- .stestr.conf | 4 ++++ .testr.conf | 7 ------- lower-constraints.txt | 3 +-- test-requirements.txt | 2 +- tools/cover.sh | 14 +++++++++++--- tools/pretty_tox.sh | 6 ------ tox.ini | 4 ++-- 8 files changed, 20 insertions(+), 22 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf delete mode 100644 tools/pretty_tox.sh diff --git a/.gitignore b/.gitignore index d6e99e74..e15eef69 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,7 @@ develop-eggs/ doc/source/api #Testing framework -.testrepository +.stestr/ .coverage *,cover cover diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 00000000..eff6feff --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,4 @@ +[DEFAULT] +test_path=${OS_TEST_PATH:-./muranoclient/tests/unit} +top_dir=./ + diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 65d7eb84..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 ./ ${OS_TEST_PATH:-./muranoclient/tests/unit} $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/lower-constraints.txt b/lower-constraints.txt index 7cb4a0ff..6f162093 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -85,10 +85,9 @@ six==1.10.0 snowballstemmer==1.2.1 Sphinx==1.6.5 sphinxcontrib-websupport==1.0.1 -stestr==1.0.0 stevedore==1.20.0 tempest==17.1.0 -testrepository==0.0.18 +stestr==2.0.0 testscenarios==0.4 testtools==2.2.0 traceback2==1.4.0 diff --git a/test-requirements.txt b/test-requirements.txt index a653d412..4d1fd051 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,7 +8,7 @@ fixtures>=3.0.0 # Apache-2.0/BSD mock>=2.0.0 # BSD requests-mock>=1.1.0 # Apache-2.0 tempest>=17.1.0 # Apache-2.0 -testrepository>=0.0.18 # Apache-2.0/BSD +stestr>=2.0.0 # Apache-2.0 testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT oslotest>=3.2.0 # Apache-2.0 diff --git a/tools/cover.sh b/tools/cover.sh index 0157ebf7..90cb1fd1 100755 --- a/tools/cover.sh +++ b/tools/cover.sh @@ -28,7 +28,11 @@ uncommitted=$(git status --porcelain | grep -v "^??") git checkout HEAD^ baseline_report=$(mktemp -t muranoclient_coverageXXXXXXX) -find . -type f -name "*.pyc" -delete && python setup.py testr --coverage --testr-args="$*" +find . -type f -name "*.pyc" -delete +stestr run '{posargs}' +coverage combine +coverage html -d cover +coverage xml -o cover/coverage.xml coverage report > $baseline_report baseline_missing=$(awk 'END { print $3 }' $baseline_report) @@ -38,7 +42,11 @@ git checkout - # Generate and save coverage report current_report=$(mktemp -t muranoclient_coverageXXXXXXX) -find . -type f -name "*.pyc" -delete && python setup.py testr --coverage --testr-args="$*" +find . -type f -name "*.pyc" -delete +stestr run '{posargs}' +coverage combine +coverage html -d cover +coverage xml -o cover/coverage.xml coverage report > $current_report current_missing=$(awk 'END { print $3 }' $current_report) @@ -76,4 +84,4 @@ else fi rm $baseline_report $current_report -exit $exit_code \ No newline at end of file +exit $exit_code diff --git a/tools/pretty_tox.sh b/tools/pretty_tox.sh deleted file mode 100644 index dcab82c7..00000000 --- a/tools/pretty_tox.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail - -TESTRARGS=$1 -python setup.py testr --slowest --testr-args="--subunit $TESTRARGS" | subunit-trace -f \ No newline at end of file diff --git a/tox.ini b/tox.ini index 743bd1c6..17004cfc 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = bash tools/pretty_tox.sh '{posargs}' +commands = stestr run {posargs} [testenv:pep8] basepython = python3 @@ -35,7 +35,7 @@ passenv = OS_* MURANO_PACKAGES_SERVICE [testenv:uitests] basepython = python3 -commands = python setup.py testr --slowest --testr-args="--concurrency 1 {posargs}" +commands = stestr run --slowest --concurrency 1 {posargs} [testenv:cover] basepython = python3