def _ts_gen(por, suite, regex): #{{{ if not isinstance(regex, _REType): raise TypeError("%s object is not a compiled regular expression" %regex.__class__.__name__) topdir = pkg_dirname(por, suite) for dir, subdir, files in resource_walk(por, topdir): for d in subdir: path = pp.join(topdir, d) if hasinit(por, path) and regex.match(d): yield absmodpath(por, path) break
def _tm_gen(por, suite, regex): #{{{ if not isinstance(regex, _REType): raise TypeError("%s object is not a compiled regular expression" %regex.__class__.__name__) topdir = pkg_dirname(por, suite) for dir, subdir, files in resource_walk(por, topdir): for f in files: name, ext = op.splitext(f) if ext == '.py' and regex.match(name): yield absmodpath(por, pp.join(topdir, f)) break
def allrstfiles(package_or_requirement, dir): #{{{ por = package_or_requirement if not resource_isdir(por, dir): raise OSError("No such directory: %s" %dir) for root, dirs, files in resource_walk(por, dir): for f in files: name, ext = op.splitext(f) if ext == '.rst': yield f return
def suite(): #{{{ test = TestSuite() for f in allrstfiles(por, dir): test.addTest(doctest.DocFileSuite(pp.join(dir, f), module_relative=False)) if recurse: for curdir, subdir, files in resource_walk(por, dir): for d in subdir: adir = pp.join(curdir, d) for f in allrstfiles(por, adir): test.addTest(doctest.DocFileSuite(pp.join(adir, f), module_relative=False)) return test