From 7681ed7c727f4a15fff95cbb2e52638ec4d14fe4 Mon Sep 17 00:00:00 2001
From: Rui Yuan Dou <rydou@fiberhome.com>
Date: Wed, 19 Dec 2018 10:32:28 +0800
Subject: [PATCH] Add .stestr.conf configuration

os-testr has moved over to use stestr instead of testr. While this
is usually compaible with existing settings, there is a warning
that is emitted when .stestr.conf is not present. It is usually
able to fall back to parsing the .testr.conf file, but to be more
correct and to prevent future problems we should update the config.

Change-Id: I95a6d1135fb4861bd3fb2086ae7a63e486130db0
Closes-Bug: #1809062
---
 .gitignore   |  1 +
 .stestr.conf |  3 +++
 .testr.conf  |  7 -------
 tox.ini      | 14 +++++++++++---
 4 files changed, 15 insertions(+), 10 deletions(-)
 create mode 100644 .stestr.conf
 delete mode 100644 .testr.conf

diff --git a/.gitignore b/.gitignore
index 194b3d403..e5015e7ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,4 @@ etc/zaqar.conf.sample
 .idea
 # Files created by releasenotes build
 releasenotes/build
+.stestr/
diff --git a/.stestr.conf b/.stestr.conf
new file mode 100644
index 000000000..5645642c5
--- /dev/null
+++ b/.stestr.conf
@@ -0,0 +1,3 @@
+[DEFAULT]
+test_path=${OS_TEST_PATH:-./zaqar/tests/unit}
+top_dir=${OS_TOP_LEVEL:-./}
diff --git a/.testr.conf b/.testr.conf
deleted file mode 100644
index 17b0e3b3b..000000000
--- a/.testr.conf
+++ /dev/null
@@ -1,7 +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} $JIT_FLAG -m subunit.run discover -t ${OS_TOP_LEVEL:-./} ${OS_TEST_PATH:-./zaqar/tests/unit} $LISTOPT $IDOPTION
-test_id_option=--load-list $IDFILE
-test_list_option=--list
diff --git a/tox.ini b/tox.ini
index 4ea8baeda..f788747b1 100644
--- a/tox.ini
+++ b/tox.ini
@@ -10,6 +10,10 @@ setenv = VIRTUAL_ENV={envdir}
          ZAQAR_TESTS_CONFIGS_DIR={toxinidir}/zaqar/tests/etc/
          ZAQAR_TEST_MONGODB=1
          ZAQAR_TEST_SLOW=1
+         OS_STDOUT_CAPTURE=1
+         OS_STDERR_CAPTURE=1
+         OS_TEST_TIMEOUT=60
+         OS_TEST_PATH=./zaqar/tests/unit
 deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
        -r{toxinidir}/requirements.txt
        -r{toxinidir}/test-requirements.txt
@@ -43,10 +47,14 @@ commands =
 
 [testenv:cover]
 basepython = python3
+setenv =
+    {[testenv]setenv}
+    PYTHON=coverage run --source zaqar --parallel-mode
 commands =
-  python setup.py testr --coverage \
-    --testr-args='^(?!.*test.*coverage).*$'
-  coverage report
+    stestr run {posargs}
+    coverage combine
+    coverage html -d cover
+    coverage xml -o cover/coverage.xml
 
 [testenv:venv]
 basepython = python3