From 1f8a317ace2f250abf311e76360074f858536462 Mon Sep 17 00:00:00 2001 From: Vu Cong Tuan Date: Wed, 11 Jul 2018 15:05:28 +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: Iee69eae0043a401eb355a1fcb957879904882e85 --- .gitignore | 3 +-- .stestr.conf | 4 ++++ .testr.conf | 9 -------- bin/barbican.sh | 2 +- doc/requirements.txt | 2 +- functionaltests/pretty_tox.sh | 10 --------- lower-constraints.txt | 2 -- test-requirements.txt | 5 ++--- tox.ini | 39 ++++++++++++++++++++++++++--------- 9 files changed, 38 insertions(+), 38 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf delete mode 100644 functionaltests/pretty_tox.sh diff --git a/.gitignore b/.gitignore index ffb9ac2fc..1f835a938 100644 --- a/.gitignore +++ b/.gitignore @@ -27,11 +27,10 @@ pip-log.txt # Unit test / coverage reports cover -.testrepository +.stestr/ .coverage .coverage.* .tox -nosetests.xml coverage.xml flake8.log diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 000000000..d242a5b10 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,4 @@ +[DEFAULT] +test_path=${OS_TEST_PATH:-./barbican/tests/} +top_dir=./ + diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index c1022c03a..000000000 --- a/.testr.conf +++ /dev/null @@ -1,9 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \ - ${PYTHON:-python} -m subunit.run discover -s ${OS_TEST_PATH:-./barbican/tests/} -t . $LISTOPT $IDOPTION - -test_id_option=--load-list $IDFILE -test_list_option=--list -group_regex=([^\.]+\.)+ diff --git a/bin/barbican.sh b/bin/barbican.sh index cf95ac5ba..fce0839e1 100755 --- a/bin/barbican.sh +++ b/bin/barbican.sh @@ -94,7 +94,7 @@ install_barbican() pip install -e . # Run unit tests - python setup.py testr + stestr run start_barbican } diff --git a/doc/requirements.txt b/doc/requirements.txt index 121ae8e7a..6184c3d8c 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -5,4 +5,4 @@ reno>=2.5.0 # Apache-2.0 os-api-ref>=1.4.0 # Apache-2.0 openstackdocstheme>=1.18.1 # Apache-2.0 castellan >= 0.17 # Apache-2.0 -pykmip==0.7.0 # Apache 2.0 License +pykmip>=0.7.0 # Apache 2.0 License diff --git a/functionaltests/pretty_tox.sh b/functionaltests/pretty_tox.sh deleted file mode 100644 index d686b5b9e..000000000 --- a/functionaltests/pretty_tox.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail - -TESTRARGS=$1 -python setup.py testr --coverage --testr-args="--subunit $TESTRARGS" | subunit-trace --no-failure-debug -f -retval=$? -echo -e "\nSlowest Tests:\n" -testr slowest -exit $retval diff --git a/lower-constraints.txt b/lower-constraints.txt index b7df09545..e8b23a5a7 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -60,7 +60,6 @@ netifaces==0.10.6 openstackdocstheme==1.18.1 os-api-ref==1.4.0 os-client-config==1.29.0 -os-testr==1.0.0 oslo.cache==1.29.0 oslo.concurrency==3.26.0 oslo.config==5.2.0 @@ -123,7 +122,6 @@ stevedore==1.20.0 tempest==17.1.0 Tempita==0.5.2 tenacity==4.9.0 -testrepository==0.0.18 testresources==2.0.1 testscenarios==0.5.0 testtools==2.2.0 diff --git a/test-requirements.txt b/test-requirements.txt index 9066edb38..301d52d06 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -9,9 +9,8 @@ coverage!=4.4,>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT mock>=2.0.0 # BSD oslotest>=3.2.0 # Apache-2.0 -os-testr>=1.0.0 # Apache-2.0 -pykmip==0.7.0 # Apache 2.0 License -testrepository>=0.0.18 # Apache-2.0/BSD +pykmip>=0.7.0 # Apache 2.0 License +stestr>=2.0.0 # Apache-2.0 testtools>=2.2.0 # MIT fixtures>=3.0.0 # Apache-2.0/BSD requests>=2.14.2 # Apache-2.0 diff --git a/tox.ini b/tox.ini index b0f49d205..4a1b02049 100644 --- a/tox.ini +++ b/tox.ini @@ -4,6 +4,8 @@ envlist = py35,py27,pep8,docs skipsdist = True [testenv] +setenv = + PYTHON=coverage run --source barbican --parallel-mode usedevelop = True install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} -U {opts} {packages} deps = -r{toxinidir}/requirements.txt @@ -14,7 +16,10 @@ commands = /usr/bin/find . -type f -name "*.py[c|o]" -delete rm -f .testrepository/times.dbm coverage erase - python setup.py testr --coverage --testr-args='{posargs}' + stestr run '{posargs}' + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml coverage report -m whitelist_externals = rm @@ -25,9 +30,11 @@ deps = diff_cover commands = coverage erase - python setup.py testr --coverage --testr-args='{posargs}' - coverage xml - diff-cover --fail-under 100 --compare-branch master coverage.xml + stestr run '{posargs}' + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml + diff-cover --fail-under 100 --compare-branch master cover/coverage.xml [testenv:releasenotes] basepython = python3 @@ -97,19 +104,27 @@ commands = # This tox env is purely to make local test development easier # Note: This requires local running instances of Barbican and Keystone deps = -r{toxinidir}/test-requirements.txt -setenv = OS_TEST_PATH={toxinidir}/functionaltests +setenv = + OS_TEST_PATH={toxinidir}/functionaltests commands = /usr/bin/find . -type f -name "*.py[c|o]" -delete - /bin/bash {toxinidir}/functionaltests/pretty_tox.sh '{posargs}' + stestr run --slowest {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml passenv = KMIP_PLUGIN_ENABLED [testenv:py35functional] basepython = python3 deps = -r{toxinidir}/test-requirements.txt -setenv = OS_TEST_PATH={toxinidir}/functionaltests +setenv = + OS_TEST_PATH={toxinidir}/functionaltests commands = /usr/bin/find . -type f -name "*.py[c|o]" -delete - /bin/bash {toxinidir}/functionaltests/pretty_tox.sh '{posargs}' + stestr run --slowest {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml passenv = KMIP_PLUGIN_ENABLED [testenv:cmd] @@ -117,10 +132,14 @@ basepython = python3 # This tox env is purely to make local test development easier # Note: This requires local running instances of Barbican and Keystone deps = -r{toxinidir}/test-requirements.txt -setenv = OS_TEST_PATH={toxinidir}/barbican/cmd/functionaltests +setenv = + OS_TEST_PATH={toxinidir}/barbican/cmd/functionaltests commands = /usr/bin/find . -type f -name "*.py[c|o]" -delete - /bin/bash {toxinidir}/functionaltests/pretty_tox.sh '{posargs}' + stestr run '{posargs}' + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml [flake8] filename = *.py,app.wsgi