Ejemplo n.º 1
0
def addtest(suite=None): #{{{
    if not suite or isinstance(suite, TestSuite) or (isobjclass(suite) and issubclass(suite, TestCase)):
        return _addtest_testcase(suite)
    elif isfunction(suite):
        return addtest()(suite)
    elif isinstance(suite, basestring):
        return _addtest_str(suite)
    raise TypeError('Cannot create test suite from %s object' %suite.__class__.__name__)
Ejemplo n.º 2
0
 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