def _ato_gen(suite, regex, filenames): #{{{
    if not isinstance(regex, _REType):
        raise TypeError("%s object is not a compiled regular expression" %regex.__class__.__name__)
    for modname in alltestnames(suite, regex, filenames):
        if filenames:
            mod = fromfile(modname)
        else:
            mod = modpathmod(modname)
        sfunc = getattr(mod, 'suite', None)
        if not sfunc or not iscallable(sfunc):
            raise ValueError("Test module '%s' is missing a suite callable" %modname)
        yield sfunc
        def wrapper(): #{{{
            test = TestSuite()
            insys = isfindable(suite)
            selfmod = pathmod(suite) if insys else fromfile(suite)
            test.addTests(sfunc() for sfunc in alltestobjects(selfmod, filenames=(not insys)))
            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(): #{{{
     mf = op.abspath(magicfile)
     curmod = pathmod(mf) if isfindable(mf) else fromfile(mf)
     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