e3198cb
From 97aec93e2b2c0d2dc6a0d7ddddba962dee007cec Mon Sep 17 00:00:00 2001
e3198cb
From: Ha Manh Dong <donghm@vn.fujitsu.com>
e3198cb
Date: Wed, 18 Jul 2018 20:14:05 -0400
e3198cb
Subject: [PATCH 16/21] Switch to use stestr for unit test
e3198cb
e3198cb
According to Openstack summit session [1],
e3198cb
stestr is maintained project to which all Openstack projects should migrate.
e3198cb
So we should switch to stestr.
e3198cb
e3198cb
[1] https://etherpad.openstack.org/p/YVR-python-pti
e3198cb
e3198cb
Change-Id: I14ae3879465e622f36fd7bba3f04cb6e0cb7500e
e3198cb
---
e3198cb
 .stestr.conf          |  3 +++
e3198cb
 .testr.conf           |  4 ----
e3198cb
 lower-constraints.txt |  2 +-
e3198cb
 test-requirements.txt |  2 +-
e3198cb
 tox.ini               | 10 ++++++++--
e3198cb
 5 files changed, 14 insertions(+), 9 deletions(-)
e3198cb
 create mode 100644 .stestr.conf
e3198cb
 delete mode 100644 .testr.conf
e3198cb
e3198cb
diff --git a/.stestr.conf b/.stestr.conf
e3198cb
new file mode 100644
e3198cb
index 0000000..7458bd2
e3198cb
--- /dev/null
e3198cb
+++ b/.stestr.conf
e3198cb
@@ -0,0 +1,3 @@
e3198cb
+[DEFAULT]
e3198cb
+test_path=./heat_cfntools/tests
e3198cb
+top_dir=./
e3198cb
diff --git a/.testr.conf b/.testr.conf
e3198cb
deleted file mode 100644
e3198cb
index 8528c86..0000000
e3198cb
--- a/.testr.conf
e3198cb
+++ /dev/null
e3198cb
@@ -1,4 +0,0 @@
e3198cb
-[DEFAULT]
e3198cb
-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
e3198cb
-test_id_option=--load-list $IDFILE
e3198cb
-test_list_option=--list
e3198cb
diff --git a/lower-constraints.txt b/lower-constraints.txt
e3198cb
index d884e51..260b010 100644
e3198cb
--- a/lower-constraints.txt
e3198cb
+++ b/lower-constraints.txt
e3198cb
@@ -4,5 +4,5 @@ mock==1.0
e3198cb
 pbr==0.8
e3198cb
 psutil==1.1.1
e3198cb
 six==1.9.0
e3198cb
-testrepository==0.0.18
e3198cb
+stestr==2.0.0
e3198cb
 testtools==0.9.34
e3198cb
diff --git a/test-requirements.txt b/test-requirements.txt
e3198cb
index 7a25edc..4550481 100644
e3198cb
--- a/test-requirements.txt
e3198cb
+++ b/test-requirements.txt
e3198cb
@@ -1,4 +1,4 @@
e3198cb
 hacking>=0.9.0
e3198cb
 mock>=1.0
e3198cb
-testrepository>=0.0.18
e3198cb
+stestr>=2.0.0
e3198cb
 testtools>=0.9.34
e3198cb
diff --git a/tox.ini b/tox.ini
e3198cb
index ffe1237..aa31c5b 100644
e3198cb
--- a/tox.ini
e3198cb
+++ b/tox.ini
e3198cb
@@ -6,7 +6,7 @@ setenv = VIRTUAL_ENV={envdir}
e3198cb
 install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
e3198cb
 deps = -r{toxinidir}/requirements.txt
e3198cb
        -r{toxinidir}/test-requirements.txt
e3198cb
-commands = python setup.py testr --slowest --testr-args='{posargs}'
e3198cb
+commands = stestr run --slowest {posargs}
e3198cb
 
e3198cb
 [testenv:pep8]
e3198cb
 basepython = python3
e3198cb
@@ -21,8 +21,14 @@ commands = bash tools/lintstack.sh
e3198cb
 
e3198cb
 [testenv:cover]
e3198cb
 basepython = python3
e3198cb
+setenv =
e3198cb
+    {[testenv]setenv}
e3198cb
+    PYTHON=coverage run --source heat_cfntools --parallel-mode
e3198cb
 commands =
e3198cb
-  python setup.py testr --coverage --testr-args='{posargs}'
e3198cb
+    stestr run {posargs}
e3198cb
+    coverage combine
e3198cb
+    coverage html -d cover
e3198cb
+    coverage xml -o cover/coverage.xml
e3198cb
 
e3198cb
 [testenv:venv]
e3198cb
 basepython = python3
e3198cb
-- 
e3198cb
2.20.1
e3198cb