blob: 3fbb8e1336b7c8f5edb2f45e190c8299f1464c1e [file] [log] [blame]
Matthew Treinish87f772c2013-12-16 20:07:42 +00001# Copyright 2013 IBM Corp.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import os
Attila Fazekasefe84bb2014-01-25 16:55:12 +010016import sys
17
18if sys.version_info >= (2, 7):
19 import unittest
20else:
21 import unittest2 as unittest
Matthew Treinish87f772c2013-12-16 20:07:42 +000022
23
24def load_tests(loader, tests, pattern):
25 suite = unittest.TestSuite()
26 base_path = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
27 base_path = os.path.split(base_path)[0]
28 for test_dir in ['./tempest/api', './tempest/cli', './tempest/scenario',
29 './tempest/thirdparty']:
30 if not pattern:
31 suite.addTests(loader.discover(test_dir, top_level_dir=base_path))
32 else:
33 suite.addTests(loader.discover(test_dir, pattern=pattern,
34 top_level_dir=base_path))
35 return suite