示例#1
0
def load_unit_tests():
    """
    Load all unit tests and return a TestSuite object
    """
    # Discover all unit tests. By simple convention those are kept in
    # python modules that start with the word 'test_' .
    return defaultTestLoader.discover(os.path.dirname(getabsfile(checkbox)))
示例#2
0
def load_unit_tests():
    """
    Load all unit tests and return a TestSuite object
    """
    # Discover all unit tests. By simple convention those are kept in
    # python modules that start with the word 'test_' .
    return defaultTestLoader.discover(get_plainbox_dir())
示例#3
0
def load_unit_tests():
    """
    Load all unit tests and return a TestSuite object
    """
    # Discover all unit tests. By simple convention those are kept in
    # python modules that start with the word 'test_' .
    return defaultTestLoader.discover(get_plainbox_dir())
示例#4
0
def load_unit_tests():
    """
    Load all unit tests and return a TestSuite object
    """
    # Discover all unit tests. By simple convention those are kept in
    # python modules that start with the word 'test_' .
    start_dir = os.path.normpath(os.path.join(get_plainbox_dir(), '..'))
    return defaultTestLoader.discover(start_dir)
示例#5
0
def load_integration_tests():
    """
    Load all integration tests and return a TestSuite object
    """
    # Discover all integration tests. By simple convention those are kept in
    # python modules that start with the word 'integration_' .
    return defaultTestLoader.discover(get_plainbox_dir(),
                                      pattern="integration_*.py")
示例#6
0
文件: tests.py 项目: yphus/plainbox
def test_suite():
    """
    Test suite function used by setuptools test loader.

    Uses unittest test discovery system to get a list of test cases defined
    inside plainbox. See setup.py setup(test_suite=...) for a matching entry
    """
    return defaultTestLoader.discover(get_plainbox_dir())
示例#7
0
def test_suite():
    """
    Test suite function used by setuptools test loader.

    Uses unittest test discovery system to get a list of test cases defined
    inside plainbox. See setup.py setup(test_suite=...) for a matching entry
    """
    return defaultTestLoader.discover(get_plainbox_dir())
示例#8
0
    def get_tests_two(self, discovery_root, pattern):
        tests = defaultTestLoader.discover(
            discovery_root,
            pattern=pattern,
            top_level_dir=settings.ROOT_DIR,
        )

        return [tests]
示例#9
0
def load_integration_tests():
    """
    Load all integration tests and return a TestSuite object
    """
    # Discover all integration tests. By simple convention those are kept in
    # python modules that start with the word 'integration_' .
    return defaultTestLoader.discover(
        get_plainbox_dir(), pattern="integration_*.py")
示例#10
0
def load_unit_tests():
    """
    Load all unit tests and return a TestSuite object
    """
    # Discover all unit tests. By simple convention those are kept in
    # python modules that start with the word 'test_' .
    return defaultTestLoader.discover(
        os.path.dirname(getabsfile(checkbox)))
def load_unit_tests():
    """
    Load all unit tests and return a TestSuite object
    """
    # Discover all unit tests. By simple convention those are kept in
    # python modules that start with the word 'test_' .
    start_dir = os.path.dirname(getabsfile(checkbox_support))
    top_level_dir = os.path.normpath(os.path.join(start_dir, '..'))
    return defaultTestLoader.discover(start_dir, top_level_dir=top_level_dir)
示例#12
0
    def build_suite(self, test_labels, extra_tests=None, **kwargs):
        for label in test_labels:

            if '.' in label:
                parts = label.split('.')
                app = get_project_app(parts[0])
                discovery_root = dirname(app.__file__)
                suite = get_tests(app, parts, discovery_root)
            else:
                app = get_project_app(label)
                app_dir = dirname(app.__file__)
                suite = defaultTestLoader.discover(app_dir, pattern="*test*.py")

        return reorder_suite(suite, (TestCase,))
示例#13
0
    def build_suite(self, test_labels, extra_tests=None, **kwargs):
        for label in test_labels:

            if '.' in label:
                parts = label.split('.')
                app = get_project_app(parts[0])
                discovery_root = dirname(app.__file__)
                suite = get_tests(app, parts, discovery_root)
            else:
                app = get_project_app(label)
                app_dir = dirname(app.__file__)
                suite = defaultTestLoader.discover(app_dir, pattern="*test*.py")

        return reorder_suite(suite, (TestCase,))
示例#14
0
    def build_suite(self, test_labels, extra_tests=None, **kwargs):
        suite = None
        discovery_root = settings.TEST_DISCOVERY_ROOT

        if test_labels:
            suite = defaultTestLoader.loadTestsFromNames(test_labels)
            # if single named module has no tests, do discovery within it
            if not suite.countTestCases() and len(test_labels) == 1:
                suite = None
                discovery_root = import_module(test_labels[0]).__path__[0]

        if suite is None:
            suite = defaultTestLoader.discover(
                discovery_root,
                top_level_dir=settings.BASE_PATH,
            )

        if extra_tests:
            for test in extra_tests:
                suite.addTest(test)

        return reorder_suite(suite, (TestCase, ))
示例#15
0
    def build_suite(self, test_labels, extra_tests=None, **kwargs):
        suite = None
        discovery_root = settings.TEST_DISCOVERY_ROOT

        if test_labels:
            suite = defaultTestLoader.loadTestsFromNames(test_labels)
            # if single named module has no tests, do discovery within it
            if not suite.countTestCases() and len(test_labels) == 1:
                suite = None
                discovery_root = import_module(test_labels[0]).__path__[0]

        if suite is None:
            suite = defaultTestLoader.discover(
                discovery_root,
                top_level_dir=settings.BASE_PATH,
                )

        if extra_tests:
            for test in extra_tests:
                suite.addTest(test)

        return reorder_suite(suite, (TestCase,))
示例#16
0
# -*- coding: utf-8 -*-
from sys import exit
from unittest.loader import defaultTestLoader
from unittest.runner import TextTestRunner
from unittest.suite import TestSuite

if __name__ == '__main__':
    中研院服務試驗包 = TestSuite()
    中研院服務試驗包.addTest(defaultTestLoader.discover('.',
                                                pattern='Test中研院*整合試驗.py'))
    試驗結果 = TextTestRunner().run(中研院服務試驗包)
    if len(試驗結果.errors) > 0 or len(試驗結果.failures) > 0:
        exit(1)
# -*- coding: utf-8 -*-
from sys import exit
from unittest.loader import defaultTestLoader
from unittest.runner import TextTestRunner
from unittest.suite import TestSuite


if __name__ == '__main__':
    中研院服務試驗包 = TestSuite()
    中研院服務試驗包.addTest(
        defaultTestLoader.discover(
            '.', pattern='Test中研院*整合試驗.py'
        )
    )
    試驗結果 = TextTestRunner().run(中研院服務試驗包)
    if len(試驗結果.errors) > 0 or len(試驗結果.failures) > 0:
        exit(1)
示例#18
0
def test_collector():
    curr_dir = os.path.abspath(os.path.dirname(__file__))
    suite = defaultTestLoader.discover(curr_dir)
    return suite