From 1bd1f9e639f07b4f53be30ee887f9cced5d80d2a Mon Sep 17 00:00:00 2001 From: Vu Cong Tuan Date: Thu, 12 Jul 2018 15:29:17 +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: I4defbb8d866ae847253d4873891f7d2eb2593ed6 --- .gitignore | 4 +++- .stestr.conf | 4 ++++ .testr.conf | 7 ------- test-requirements.txt | 3 +-- tools/pretty_tox.sh | 16 ---------------- tox.ini | 43 ++++++++++++++++++++++++++++++++++++++----- 6 files changed, 46 insertions(+), 31 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 cbe9e56..2e2c30a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ /build/ -.testrepository +.stestr/ .tox/ ceilometer_powervm.egg-info/ *.pyc @@ -7,3 +7,5 @@ doc/build AUTHORS ChangeLog /.idea/ +.coverage +cover/ diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..527ec98 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,4 @@ +[DEFAULT] +test_path=./ceilometer_powervm/tests +top_dir=./ + diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 3199fbb..0000000 --- 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:-600} \ - ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/test-requirements.txt b/test-requirements.txt index 6006621..18b5866 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -7,11 +7,10 @@ bashate>=0.5.1 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD python-subunit>=1.0.0 # Apache-2.0/BSD -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 oslotest>=3.2.0 # Apache-2.0 -os-testr>=1.0.0 # Apache-2.0 sphinx!=1.6.6,!=1.6.7,>=1.6.5 # BSD oslosphinx>=4.7.0 # Apache-2.0 mock>=2.0.0 # BSD diff --git a/tools/pretty_tox.sh b/tools/pretty_tox.sh deleted file mode 100644 index 799ac18..0000000 --- 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 ce6b40e..b416fd6 100644 --- a/tox.ini +++ b/tox.ini @@ -11,16 +11,39 @@ ignore_basepython_conflict = True basepython = python3 usedevelop = True install_command = pip install {opts} {packages} -setenv = VIRTUAL_ENV={envdir} - PYTHONHASHSEED=0 +setenv = + VIRTUAL_ENV={envdir} + PYTHONHASHSEED=0 + 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 -r{toxinidir}/test-requirements.txt -egit+https://git.openstack.org/openstack/ceilometer#egg=ceilometer -rhttps://git.openstack.org/cgit/openstack/ceilometer/plain/test-requirements.txt -whitelist_externals = bash -commands = bash tools/pretty_tox.sh '{posargs}' +whitelist_externals = + bash + find +commands = + find . -type f -name "*.pyc" -delete + +[testenv:py27] +basepython = python2.7 +commands = + {[testenv]commands} + stestr run {posargs} + stestr slowest + +[testenv:py35] +basepython = python3.5 +commands = + {[testenv]commands} + stestr run {posargs} + stestr slowest [testenv:pep8] commands = flake8 @@ -29,7 +52,17 @@ commands = flake8 commands = {posargs} [testenv:cover] -commands = python -m ceilometer.openstack.common.lockutils python setup.py testr --slowest --coverage --testr-args="{posargs}" +setenv = + {[testenv]setenv} + PYTHON=coverage run --source ceilometer_powervm --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] commands = python setup.py build_sphinx