@copydoc(unittest.TestLoader.discover)
    def discover(self, start_dir, pattern='test*.py', top_level_dir=None):
        tmp_suite = super(LambdaTestDiscoverer, self).discover(start_dir=start_dir, pattern=pattern,
                                                        top_level_dir=top_level_dir)

        res_suite = unittest.TestSuite()
        flattened_suite = self._flatten_suite(tmp_suite)
        found_set = set()
        test_list = []

        for case in flattened_suite:
            test_name = str(case).split(' ')[0]
            class_name = case.__class__.__name__
            if not hasattr(case, 'tags'):
                tags = set()
            else:
                tags = self._input2set(case.tags)

            combined = (class_name, test_name, tuple(tags))
            if combined in found_set:
                continue
            else:
                found_set.add(combined)

            if class_name == 'ModuleImportFailure':
                self._logger.error('Could not import `%s`, I will skip the tests.' % test_name)
            if class_name == 'LoadTestsFailure':
                self._logger.error('Could not load test `%s`, maybe this is an ERROR. '
                                   'I will skip the test.' % test_name)

            add = self.predicate(class_name, test_name, tags)
            if add:
                test_list.append(case)

        combined_name_key = lambda key: key.__class__.__name__ + str(key).split(' ')[0]
        test_list = sorted(test_list, key = combined_name_key)
        res_suite.addTests(test_list)
        return res_suite
dataset/ETHPy150Open SmokinCaterpillar/pypet/pypet/tests/testutils/ioutils.py/LambdaTestDiscoverer.discover/original