Blob Blame History Raw
From 97aec93e2b2c0d2dc6a0d7ddddba962dee007cec Mon Sep 17 00:00:00 2001
From: Ha Manh Dong <donghm@vn.fujitsu.com>
Date: Wed, 18 Jul 2018 20:14:05 -0400
Subject: [PATCH 16/21] Switch to use stestr for unit test

According to Openstack summit session [1],
stestr is maintained project to which all Openstack projects should migrate.
So we should switch to stestr.

[1] https://etherpad.openstack.org/p/YVR-python-pti

Change-Id: I14ae3879465e622f36fd7bba3f04cb6e0cb7500e
---
 .stestr.conf          |  3 +++
 .testr.conf           |  4 ----
 lower-constraints.txt |  2 +-
 test-requirements.txt |  2 +-
 tox.ini               | 10 ++++++++--
 5 files changed, 14 insertions(+), 9 deletions(-)
 create mode 100644 .stestr.conf
 delete mode 100644 .testr.conf

diff --git a/.stestr.conf b/.stestr.conf
new file mode 100644
index 0000000..7458bd2
--- /dev/null
+++ b/.stestr.conf
@@ -0,0 +1,3 @@
+[DEFAULT]
+test_path=./heat_cfntools/tests
+top_dir=./
diff --git a/.testr.conf b/.testr.conf
deleted file mode 100644
index 8528c86..0000000
--- a/.testr.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-[DEFAULT]
-test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ ./heat_cfntools/tests $LISTOPT $IDOPTION
-test_id_option=--load-list $IDFILE
-test_list_option=--list
diff --git a/lower-constraints.txt b/lower-constraints.txt
index d884e51..260b010 100644
--- a/lower-constraints.txt
+++ b/lower-constraints.txt
@@ -4,5 +4,5 @@ mock==1.0
 pbr==0.8
 psutil==1.1.1
 six==1.9.0
-testrepository==0.0.18
+stestr==2.0.0
 testtools==0.9.34
diff --git a/test-requirements.txt b/test-requirements.txt
index 7a25edc..4550481 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,4 +1,4 @@
 hacking>=0.9.0
 mock>=1.0
-testrepository>=0.0.18
+stestr>=2.0.0
 testtools>=0.9.34
diff --git a/tox.ini b/tox.ini
index ffe1237..aa31c5b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,7 +6,7 @@ setenv = VIRTUAL_ENV={envdir}
 install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
 deps = -r{toxinidir}/requirements.txt
        -r{toxinidir}/test-requirements.txt
-commands = python setup.py testr --slowest --testr-args='{posargs}'
+commands = stestr run --slowest {posargs}
 
 [testenv:pep8]
 basepython = python3
@@ -21,8 +21,14 @@ commands = bash tools/lintstack.sh
 
 [testenv:cover]
 basepython = python3
+setenv =
+    {[testenv]setenv}
+    PYTHON=coverage run --source heat_cfntools --parallel-mode
 commands =
-  python setup.py testr --coverage --testr-args='{posargs}'
+    stestr run {posargs}
+    coverage combine
+    coverage html -d cover
+    coverage xml -o cover/coverage.xml
 
 [testenv:venv]
 basepython = python3
-- 
2.20.1