1 # Copyright (C) 2016 Nippon Telegraph and Telephone Corporation.
2 # Copyright (C) 2016 Fumihiko Kakuma <kakuma at valinux co jp>
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 from __future__ import absolute_import
27 def load_tests(loader, tests, pattern):
28 dirname = os.path.dirname(os.path.abspath(__file__))
29 base_path = os.path.abspath(dirname + '/../../..')
30 suite = unittest.TestSuite()
31 for test_dir in ['ryu/tests/integrated/bgp']:
33 suite.addTests(loader.discover(test_dir,
34 top_level_dir=base_path))
36 suite.addTests(loader.discover(test_dir, pattern=pattern,
37 top_level_dir=base_path))
41 if __name__ == '__main__':
42 log.early_init_log(logging.DEBUG)
44 LOG = logging.getLogger(__name__)
46 if len(sys.argv) == 2:
48 loader = unittest.defaultTestLoader
49 suite = load_tests(loader, None, pattern)
50 res = unittest.TextTestRunner(verbosity=2).run(suite)
52 if res.errors or res.failures: