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_' . return defaultTestLoader.discover(get_plainbox_dir())
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)
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")
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())
def get_tests_two(self, discovery_root, pattern): tests = defaultTestLoader.discover( discovery_root, pattern=pattern, top_level_dir=settings.ROOT_DIR, ) return [tests]
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")
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)
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,))
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, ))
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,))
# -*- 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)
def test_collector(): curr_dir = os.path.abspath(os.path.dirname(__file__)) suite = defaultTestLoader.discover(curr_dir) return suite