From de35385320fe8dff51b98da0ec0496d7c30db59b Mon Sep 17 00:00:00 2001
From: lukken <lukken@astron.nl>
Date: Tue, 20 Jul 2021 09:28:10 +0000
Subject: [PATCH] L2SS-240: Configure tox for both tests directories

---
 devices/.stestr.conf                 |  2 +-
 devices/integration_test/README.md   |  3 +++
 devices/integration_test/__init__.py |  0
 devices/integration_test/base.py     | 25 +++++++++++++++++++++++++
 devices/tox.ini                      |  6 ++++++
 5 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 devices/integration_test/README.md
 create mode 100644 devices/integration_test/__init__.py
 create mode 100644 devices/integration_test/base.py

diff --git a/devices/.stestr.conf b/devices/.stestr.conf
index ddc59860d..07147c869 100644
--- a/devices/.stestr.conf
+++ b/devices/.stestr.conf
@@ -1,3 +1,3 @@
 [DEFAULT]
-test_path=./test
+test_path=${TESTS_DIR:-./test}
 top_dir=./
diff --git a/devices/integration_test/README.md b/devices/integration_test/README.md
new file mode 100644
index 000000000..e6bb82149
--- /dev/null
+++ b/devices/integration_test/README.md
@@ -0,0 +1,3 @@
+# Integration tests
+
+**Warning running these tests will make changes to your local system**
\ No newline at end of file
diff --git a/devices/integration_test/__init__.py b/devices/integration_test/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/devices/integration_test/base.py b/devices/integration_test/base.py
new file mode 100644
index 000000000..92601ec2d
--- /dev/null
+++ b/devices/integration_test/base.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+#
+# This file is part of the LOFAR 2.0 Station Software
+#
+#
+#
+# Distributed under the terms of the APACHE license.
+# See LICENSE.txt for more info.
+
+import unittest
+import testscenarios
+
+
+class BaseIntegrationTestCase(testscenarios.WithScenarios, unittest.TestCase):
+    """Integration test base class."""
+
+    def setUp(self):
+        super().setUp()
+
+
+class IntegrationTestCase(BaseIntegrationTestCase):
+    """Integration test case base class for all unit tests."""
+
+    def setUp(self):
+        super().setUp()
diff --git a/devices/tox.ini b/devices/tox.ini
index 18c6cda38..29fed5a88 100644
--- a/devices/tox.ini
+++ b/devices/tox.ini
@@ -17,6 +17,12 @@ deps = -r{toxinidir}/test-requirements.txt
     -r{toxinidir}/../docker-compose/lofar-device-base/lofar-requirements.txt
 commands = stestr run {posargs}
 
+[testenv:integration]
+; Warning running integration tests will make changes to your docker system!
+setenv = TESTS_DIR=./integration_test
+commands =
+    stestr run --serial
+
 ; TODO(Corne): Integrate Hacking to customize pep8 rules
 [testenv:pep8]
 commands =
-- 
GitLab