def _filter(self, factories):
"""
Filter a list of objects using C{self.labels}.
"""
filtered = []
for obj in factories:
for label in self.labels:
if hasattr(obj, label) and getattr(obj, label) is True:
suite = obj()
if not isinstance(suite, unittest.TestSuite):
raise ValueError('Custom test function {0} must return a '
'unittest.TestSuite, not {1}'.format(obj.__name__, type(suite)))
filtered.append(suite)
return filtered
评论列表
文章目录