From b51b7fe09dc949a81b9670e7aaa6bf62979a1f22 Mon Sep 17 00:00:00 2001
From: lukken <lukken@astron.nl>
Date: Wed, 9 Jun 2021 11:41:16 +0000
Subject: [PATCH] Create tox file and support configuration files

This supports stestr unit tests as well linting with pep8 / flake8
---
 .stestr.conf          |  3 +++
 test-requirements.txt | 16 ++++++++++++++++
 tox.ini               | 22 ++++++++++++++++++++++
 3 files changed, 41 insertions(+)
 create mode 100644 .stestr.conf
 create mode 100644 test-requirements.txt
 create mode 100644 tox.ini

diff --git a/.stestr.conf b/.stestr.conf
new file mode 100644
index 000000000..10b8cdff7
--- /dev/null
+++ b/.stestr.conf
@@ -0,0 +1,3 @@
+[DEFAULT]
+test_path=./devices/test
+top_dir=./
\ No newline at end of file
diff --git a/test-requirements.txt b/test-requirements.txt
new file mode 100644
index 000000000..3a6dd8dca
--- /dev/null
+++ b/test-requirements.txt
@@ -0,0 +1,16 @@
+# The order of packages is significant, because pip processes them in the order
+# of appearance. Changing the order has an impact on the overall integration
+# process, which may cause wedges in the gate later.
+
+coverage>=5.2.0 # Apache-2.0
+doc8>=0.8.0 # Apache-2.0
+hacking>=3.2.0,<3.3.0 # Apache-2.0
+#mypy>=0.812 # MIT
+python-subunit>=1.4.0 # Apache-2.0/BSD
+Pygments>=2.6.0
+#oslotest>=4.4.0 # Apache-2.0
+#oslo.messaging>=12.2.0 # Apache-2.0
+stestr>=3.0.0 # Apache-2.0
+testscenarios>=0.5.0 # Apache-2.0/BSD
+testtools>=2.4.0 # MIT
+bandit>=1.6.0 # Apache-2.0
\ No newline at end of file
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 000000000..1a33625c2
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,22 @@
+[tox]
+minversion = 2.0
+envlist = py36,py37,py38,py39,pep8
+skipsdist = True
+
+[testenv]
+usedevelop = True
+install_command = pip3 install {opts} {packages}
+setenv =
+   VIRTUAL_ENV={envdir}
+   PYTHONWARNINGS=default::DeprecationWarning
+   OS_STDOUT_CAPTURE=1
+   OS_STDERR_CAPTURE=1
+   OS_TEST_TIMEOUT=60
+deps = -r{toxinidir}/test-requirements.txt
+commands = stestr run {posargs}
+
+[testenv:pep8]
+commands =
+;    doc8 doc/source/ README.rst
+    flake8 {posargs}
+    bandit -r devices -x test -n5 -ll # -s B320
\ No newline at end of file
-- 
GitLab