summaryrefslogtreecommitdiff
path: root/tempest/test_discover
diff options
context:
space:
mode:
authorMatthew Treinish <treinish@linux.vnet.ibm.com>2013-12-16 20:07:42 +0000
committerMatthew Treinish <treinish@linux.vnet.ibm.com>2013-12-18 19:51:07 +0000
commit87f772c0bd59790aa43de59938d9c138963f9f4e (patch)
tree72a487ec1174a980d2f57174f139c9c8128ace22 /tempest/test_discover
parentee958416c5a33053d7b7ab72be5a00ab5d3f9387 (diff)
downloadtempest-87f772c0bd59790aa43de59938d9c138963f9f4e.tar.gz
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
Diffstat (limited to 'tempest/test_discover')
-rw-r--r--tempest/test_discover/__init__.py0
-rw-r--r--tempest/test_discover/test_discover.py32
2 files changed, 32 insertions, 0 deletions
diff --git a/tempest/test_discover/__init__.py b/tempest/test_discover/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /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 000000000..2e19bf2bd
--- /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