From 3d150141b7eae736dec6ee8fec7e82ee5dc3d5a9 Mon Sep 17 00:00:00 2001 From: Kien Nguyen Date: Wed, 28 Mar 2018 15:21:23 +0700 Subject: [PATCH] Migrate to stestr stestr is actively maintained. OpenStack is migrating to stestr, go ahead. Remove the depend on python-subunit as well. stestr takes care of that for us Change-Id: I6f845ab4ef1a1c91048666614799a03ab02ab765 --- .gitignore | 2 ++ .stestr.conf | 3 +++ .testr.conf | 7 ------- test-requirements.txt | 2 +- tools/pretty_tox.sh | 16 ---------------- tox.ini | 19 ++++++++++++++----- 6 files changed, 20 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 16aaa1a63..ce3016c93 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ cover-master nosetests.xml .testrepository .venv +.stestr # Translations *.mo @@ -66,3 +67,4 @@ etc/zun/policy.yaml.sample # etcd config file devstack/etcd.override + diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 000000000..67643551f --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=${OS_TEST_PATH:-./zun/tests/unit} +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 7d07b1171..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:-45} \ - ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./zun/tests/unit} $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/test-requirements.txt b/test-requirements.txt index 43f140f86..45b80de38 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -16,9 +16,9 @@ osprofiler>=1.4.0 # Apache-2.0 os-testr>=1.0.0 # Apache-2.0 PyMySQL>=0.7.6 # MIT License tempest>=17.1.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 reno>=2.5.0 # Apache-2.0 os-api-ref>=1.4.0 # Apache-2.0 +stestr>=1.0.0 # Apache-2.0 diff --git a/tools/pretty_tox.sh b/tools/pretty_tox.sh deleted file mode 100755 index 799ac1848..000000000 --- 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 ba60861be..50c604fe2 100644 --- a/tox.ini +++ b/tox.ini @@ -18,8 +18,8 @@ deps = -r{toxinidir}/requirements.txt commands = find . -type f -name "*.py[c|o]" -delete - rm -rf .testrepository/times.dbm - bash tools/pretty_tox.sh '{posargs}' + stestr run {posargs} + stestr slowest passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY @@ -38,12 +38,20 @@ setenv = PYTHONHASHSEED=0 commands = {posargs} [testenv:cover] -commands = {toxinidir}/tools/cover.sh {posargs} +setenv = + {[testenv]setenv} + PYTHON=coverage run --source zun --parallel-mode +commands = + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml + coverage report [testenv:docs] commands = doc8 -e .rst specs/ doc/source/ CONTRIBUTING.rst HACKING.rst README.rst - python setup.py build_sphinx + sphinx-build -W -d doc/build/doctrees -b html doc/source/ doc/build/html [testenv:debug] commands = oslo_debug_helper {posargs} @@ -62,7 +70,8 @@ setenv = {[testenv]setenv} deps = {[testenv]deps} commands = find . -type f -name "*.py[c|o]" -delete - bash tools/pretty_tox.sh '{posargs}' + stestr run {posargs} + stestr slowest [flake8] filename = *.py,app.wsgi