def wrapper(): #{{{ test = TestSuite() selfmod = pathmod(por, suite) test.addTests(sfunc() for sfunc in alltestobjects(por, selfmod)) ret = func() if isinstance(ret, TestCase) and ret not in test: test.addTest(ret) ret = None elif isinstance(ret, type) and issubclass(ret, TestCase): ret = makeSuite(ret) if isinstance(ret, TestSuite) and True not in (t in test for t in ret): test.addTest(ret) elif ret: raise TypeError("Cannot add %s object to test suite" %ret.__class__.__name__) return test
def suite(): #{{{ curmod = pathmod(por, magicfile) test = TestSuite() count = 0 for attr in dir(curmod): a = getattr(curmod, attr) if isobjclass(a) and issubclass(a, TestCase): if ignore: if (isiterable(ignore) and a in ignore) or a is ignore: continue test.addTest(makeSuite(a)) count += 1 elif isinstance(a, TestSuite): if ignore: if (isiterable(ignore) and a in ignore) or a is ignore: continue test.addTest(a) count += 1 if count: return test