From 45f7ed5a434179a4f05405d21682335e82882878 Mon Sep 17 00:00:00 2001
From: Monty Taylor <mordred@inaugust.com>
Date: Thu, 22 Mar 2018 12:59:31 -0500
Subject: [PATCH] Switch to using stestr for tests

OpenStack is switching from testrepository to stestr. Make the shift
here.

Also, while doing this, update the rest of the test-requirements.
testtools and python-subunit are removed because they are transitive
deps of oslotest and stestr already.

Change-Id: Idf1298e03a78653044532fd54a4f35dcf5c6c1c5
---
 .testr.conf           |  8 --------
 test-requirements.txt | 13 +++++--------
 tox.ini               | 17 ++++++++---------
 3 files changed, 13 insertions(+), 25 deletions(-)
 delete mode 100644 .testr.conf

diff --git a/.testr.conf b/.testr.conf
deleted file mode 100644
index 6236e319..00000000
--- a/.testr.conf
+++ /dev/null
@@ -1,8 +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:-60} \
-             ${PYTHON:-python} -m subunit.run discover storyboard/tests $LISTOPT $IDOPTION
-
-test_id_option=--load-list $IDFILE
-test_list_option=--list
diff --git a/test-requirements.txt b/test-requirements.txt
index 172411bb..c58bee30 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,12 +1,9 @@
 hacking>=1.0.0,<1.1.0
 
-coverage>=3.6
-fixtures>=0.3.14
-mock>=1.0
-python-subunit
-oslotest>=1.2.0
-os-testr>=1.0.0
-testrepository>=0.0.18
+coverage!=4.4,>=4.0 # Apache-2.0
+fixtures>=3.0.0 # Apache-2.0/BSD
+mock>=2.0 # BSD
+oslotest>=3.2.0 # Apache-2.0
+stestr>=1.0.0 # Apache-2.0
 testscenarios>=0.4,<0.5
-testtools>=0.9.34
 posix_ipc>=0.9.8
diff --git a/tox.ini b/tox.ini
index 93ed1af6..39f832ec 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,24 +6,23 @@ envlist = py35,py27,pep8
 [testenv]
 usedevelop = True
 install_command = pip install -U {opts} {packages}
+passenv = OS_* STORYBOARD_*
 setenv =
     VIRTUAL_ENV={envdir}
-    OS_STDERR_CAPTURE=1
-    OS_STDOUT_CAPTURE=1
-passenv =
-    OS_TEST_TIMEOUT
-    STORYBOARD_TEST_DB
+    OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
+    OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
+    OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
 deps = -r{toxinidir}/requirements.txt
        -r{toxinidir}/test-requirements.txt
-commands = ostestr '{posargs}'
+commands = stestr run {posargs}
+           stestr slowest
 whitelist_externals = bash
 
 [testenv:sqlite]
 basepython = python3
 setenv =
+    {[testenv]setenv}
     STORYBOARD_TEST_DB=sqlite:///{envtmpdir}
-    OS_STDERR_CAPTURE=1
-    OS_STDOUT_CAPTURE=1
 
 [testenv:pep8]
 basepython = python3
@@ -44,7 +43,7 @@ commands =
 [testenv:cover]
 basepython = python3
 setenv =
-    VIRTUAL_ENV={envdir}
+    {[testenv]setenv}
     PYTHON=coverage run --source storyboard --parallel-mode
 commands =
     stestr run {posargs}