run 827 字节
Newer Older
1 2 3 4 5
#!/usr/bin/env python
# -*- coding: utf-8 -*-

__author__ = 'Lucas Meneghel Rodrigues <lmr@redhat.com>'

6 7
import os
import sys
8
import logging
9
import unittest
10 11 12 13

logger = logging.getLogger(__name__)


14 15 16 17 18 19 20 21 22
def test_suite():
    suite = unittest.TestSuite()
    loader = unittest.TestLoader()
    selftests_dir = os.path.dirname(os.path.abspath(__file__))
    basedir = os.path.dirname(selftests_dir)
    for section in ('unit', 'functional', 'doc'):
        suite.addTests(loader.discover(start_dir=os.path.join(selftests_dir, section),
                                       top_level_dir=basedir))
    return suite
23

L
Lukáš Doktor 已提交
24

25
if __name__ == '__main__':
26
    runner = unittest.TextTestRunner(failfast=not os.environ.get("SELF_CHECK_CONTINUOUS"))
27 28 29
    result = runner.run(test_suite())
    if result.failures or result.errors:
        sys.exit(1)