Пример #1
0
        def build_suite(self, test_labels, extra_tests=None, **kwargs):
            # XXX: We shouldn't need to hook this if Mule can handle the shortname.TestCase format
            suite = unittest2.TestSuite()

            if test_labels:
                for label in test_labels:
                    if '.' in label:
                        suite.addTest(get_test_by_name(label, self.loader))
                    else:
                        app = get_app(label)
                        suite.addTest(build_suite(app))
            else:
                for app in get_apps():
                    suite.addTest(build_suite(app))

            if extra_tests:
                for test in extra_tests:
                    suite.addTest(test)
            
            new_suite = unittest2.TestSuite()
            
            for test in reorder_suite(suite, (unittest.TestCase,)):
                # XXX: Doctests (the way we do it currently) do not work
                if isinstance(test, DocTestCase):
                    continue
                if self.include_testcases and not any(isinstance(test, c) for c in self.include_testcases):
                    continue
                if self.exclude_testcases and any(isinstance(test, c) for c in self.exclude_testcases):
                    continue
                new_suite.addTest(test)

            return reorder_suite(new_suite, (unittest.TestCase,))
Пример #2
0
    def build_suite(self, test_labels, extra_tests=None, **kwargs):
        suite = unittest2.TestSuite()

        if test_labels:
            for label in test_labels:
                self.loader.loadTestsFromNames(test_labels)
        else:
            self.loader.discover(self.start_dir)

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

        new_suite = unittest2.TestSuite()

        for test in reorder_suite(suite, (unittest.TestCase, )):
            # XXX: Doctests (the way we do it currently) do not work
            if self.include_testcases and not any(
                    isinstance(test, c) for c in self.include_testcases):
                continue
            if self.exclude_testcases and any(
                    isinstance(test, c) for c in self.exclude_testcases):
                continue
            new_suite.addTest(test)

        return reorder_suite(new_suite, (unittest2.TestCase, ))
Пример #3
0
    def build_suite(self, test_labels, extra_tests=None, **kwargs):
        suite = unittest2.TestSuite()

        if test_labels:
            for label in test_labels:
                self.loader.loadTestsFromNames(test_labels)
        else:
            self.loader.discover(self.start_dir)

        if extra_tests:
            for test in extra_tests:
                suite.addTest(test)
        
        new_suite = unittest2.TestSuite()
        
        for test in reorder_suite(suite, (unittest.TestCase,)):
            # XXX: Doctests (the way we do it currently) do not work
            if self.include_testcases and not any(isinstance(test, c) for c in self.include_testcases):
                continue
            if self.exclude_testcases and any(isinstance(test, c) for c in self.exclude_testcases):
                continue
            new_suite.addTest(test)

        return reorder_suite(new_suite, (unittest2.TestCase,))