From 00adc4f2c856b120b634073620bfdd18dad48e81 Mon Sep 17 00:00:00 2001
From: Pete Vander Giessen <pete.vandergiessen@canonical.com>
Date: Thu, 7 Mar 2019 17:11:22 -0500
Subject: [PATCH] Replace ostestr with stestr in testing framework.

A system upgrade broke ostestr. We can fix it by just calling stestr
directly.

Change-Id: Iefa4a23d02aca71b6b1aba6c4369a11c054e92fa
---
 .stestr.conf              |  3 +++
 .testr.conf               |  8 --------
 src/test-requirements.txt |  2 +-
 test-requirements.txt     |  2 +-
 tox.ini                   | 10 +++++-----
 5 files changed, 10 insertions(+), 15 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..5fcccac
--- /dev/null
+++ b/.stestr.conf
@@ -0,0 +1,3 @@
+[DEFAULT]
+test_path=./unit_tests
+top_dir=./
diff --git a/.testr.conf b/.testr.conf
deleted file mode 100644
index 801646b..0000000
--- 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 -t ./ ./unit_tests $LISTOPT $IDOPTION
-
-test_id_option=--load-list $IDFILE
-test_list_option=--list
diff --git a/src/test-requirements.txt b/src/test-requirements.txt
index f013863..e56db9a 100644
--- a/src/test-requirements.txt
+++ b/src/test-requirements.txt
@@ -5,7 +5,7 @@ charm-tools>=2.4.4
 coverage>=3.6
 mock>=1.2
 flake8>=2.2.4,<=2.4.1
-os-testr>=0.4.1
+stestr>=2.2.0
 requests>=2.18.4
 # BEGIN: Amulet OpenStack Charm Helper Requirements
 # Liberty client lower constraints
diff --git a/test-requirements.txt b/test-requirements.txt
index ca62003..14b380e 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -4,7 +4,7 @@
 #
 # Lint and unit test requirements
 flake8>=2.2.4,<=2.4.1
-os-testr>=0.4.1
+stestr>=2.2.0
 requests>=2.18.4
 charms.reactive
 mock>=1.2
diff --git a/tox.ini b/tox.ini
index d3bc831..bdf922d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -47,22 +47,22 @@ commands = true
 [testenv:py3]
 basepython = python3
 deps = -r{toxinidir}/test-requirements.txt
-commands = ostestr {posargs}
+commands = stestr run {posargs}
 
 [testenv:py34]
 basepython = python3.4
 deps = -r{toxinidir}/test-requirements.txt
-commands = ostestr {posargs}
+commands = stestr run {posargs}
 
 [testenv:py35]
 basepython = python3.5
 deps = -r{toxinidir}/test-requirements.txt
-commands = ostestr {posargs}
+commands = stestr run {posargs}
 
 [testenv:py36]
 basepython = python3.6
 deps = -r{toxinidir}/test-requirements.txt
-commands = ostestr {posargs}
+commands = stestr run {posargs}
 
 [testenv:pep8]
 basepython = python3
@@ -80,7 +80,7 @@ setenv =
     PYTHON=coverage run
 commands =
     coverage erase
-    ostestr {posargs}
+    stestr run {posargs}
     coverage combine
     coverage html -d cover
     coverage xml -o cover/coverage.xml