From b669e6b1a514573ed369f8045fda1194e9c8cbd0 Mon Sep 17 00:00:00 2001
From: songwenping <songwenping@inspur.com>
Date: Tue, 28 Dec 2021 15:33:10 +0800
Subject: [PATCH] Enable unit test

Change-Id: Ib790076d775a3ab565f1334152e50cbc13244b0a
---
 .stestr.conf |  3 +++
 tox.ini      | 24 +++++++++++++++++++++---
 2 files changed, 24 insertions(+), 3 deletions(-)
 create mode 100644 .stestr.conf

diff --git a/.stestr.conf b/.stestr.conf
new file mode 100644
index 0000000..bd0b4c9
--- /dev/null
+++ b/.stestr.conf
@@ -0,0 +1,3 @@
+[DEFAULT]
+test_path=./venus/tests
+top_dir=./
diff --git a/tox.ini b/tox.ini
index 82a0eff..7da272b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -8,13 +8,17 @@ basepython = python3
 # Note the hash seed is set to 0 until venus can be tested with a
 # random hash seed successfully.
 setenv = VIRTUAL_ENV={envdir}
-         PYTHONHASHSEED=0
+         OS_TEST_PATH=venus/tests/unit
 usedevelop = True
 install_command = pip install {opts} {packages}
 
 deps =
-    -r{toxinidir}/requirements.txt
-    -r{toxinidir}/test-requirements.txt
+  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
+  -r{toxinidir}/requirements.txt
+  -r{toxinidir}/test-requirements.txt
+
+commands = rm -f .testrepository/times.dbm
+           stestr run --slowest {posargs}
 
 [testenv:releasenotes]
 deps = -r{toxinidir}/doc/requirements.txt
@@ -26,6 +30,20 @@ commands =
   # Check that .po and .pot files are valid:
   doc8 --ignore D001  doc/source/ CONTRIBUTING.rst HACKING.rst README.rst
 
+[testenv:venv]
+commands = {posargs}
+
+[testenv:cover]
+setenv =
+    PYTHON=coverage run --source cyborg --parallel-mode
+commands =
+    coverage erase
+    stestr run {posargs}
+    coverage combine
+    coverage html -d cover
+    coverage xml -o cover/coverage.xml
+    coverage report
+
 [doc8]
 ignore-path = .venv,.git,.tox,*venus/locale*,*lib/python*,*venus.egg*,api-ref/build,doc/build,doc/source/contributor/api