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
This commit is contained in:
Matthew Treinish 2013-12-16 20:07:42 +00:00
parent ee958416c5
commit 87f772c0bd
3 changed files with 33 additions and 0 deletions

View File

View File

@ -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

View File

@ -8,6 +8,7 @@ setenv = VIRTUAL_ENV={envdir}
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}