Add test_discover module to provide a load_tests hook
This commit adds a load_tests hook that will be used to discover the
set of tempest tests that excludes the unit tests. We can't just
discover from the tempest topdir like we previously did because of
mutually exclusive requirements between the normal tempest tests and
the unit tests. (for example mox and mock should not be required for
a tempest run)
Change-Id: I562f033d78e654675fd77af3bf64c44945127bd7
diff --git a/tempest/test_discover/__init__.py b/tempest/test_discover/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/test_discover/__init__.py
diff --git a/tempest/test_discover/test_discover.py b/tempest/test_discover/test_discover.py
new file mode 100644
index 0000000..2e19bf2
--- /dev/null
+++ b/tempest/test_discover/test_discover.py
@@ -0,0 +1,32 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import os
+import unittest
+
+
+def load_tests(loader, tests, pattern):
+ suite = unittest.TestSuite()
+ base_path = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
+ base_path = os.path.split(base_path)[0]
+ for test_dir in ['./tempest/api', './tempest/cli', './tempest/scenario',
+ './tempest/thirdparty']:
+ if not pattern:
+ suite.addTests(loader.discover(test_dir, top_level_dir=base_path))
+ else:
+ suite.addTests(loader.discover(test_dir, pattern=pattern,
+ top_level_dir=base_path))
+ return suite
diff --git a/tox.ini b/tox.ini
index c7f92ae..b44b3e0 100644
--- a/tox.ini
+++ b/tox.ini
@@ -8,6 +8,7 @@
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=C
+ OS_TEST_PATH=./tempest/test_discover
usedevelop = True
install_command = pip install -U {opts} {packages}