def DocFileTest(path, module_relative=True, package=None,
globs=None, parser=DocTestParser(),
encoding=None, **options):
if globs is None:
globs = {}
else:
globs = globs.copy()
if package and not module_relative:
raise ValueError("Package may only be specified for module-"
"relative paths.")
# Relativize the path.
doc, path = _load_testfile(path, package, module_relative)
if "__file__" not in globs:
globs["__file__"] = path
# Find the file and read it.
name = os.path.basename(path)
# If an encoding is specified, use it to convert the file to unicode
if encoding is not None:
doc = doc.decode(encoding)
# Convert it to a test, and wrap it in a DocFileCase.
test = parser.get_doctest(doc, globs, name, path, 0)
return DocFileCase(test, **options)
os.listdir(doc_dir) if doc.endswith('.txt')]
for test in docs:
suite.append(doctest.DocFileTest(test,
optionflags=flags, globs=globs,
setUp=setUp, tearDown=tearDown,
module_relative=False))
src/z/3/z3ext-HEAD/deprecated/z3ext.content.ext.language/trunk/src/z3ext/content/ext/language/tests/tests.py z3ext(Download)
return unittest.TestSuite((
tests,
doctest.DocFileTest(
'tests.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
))
src/z/3/z3ext-HEAD/deprecated/z3ext.content.ext.urlmapper/trunk/src/z3ext/content/ext/urlmapper/tests.py z3ext(Download)
def test_suite():
return unittest.TestSuite((
doctest.DocFileTest(
'tests.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
))
src/z/3/z3ext.content.ext.language-1.1.0/src/z3ext/content/ext/language/tests/tests.py z3ext.content.ext.language(Download)
return unittest.TestSuite((
tests,
doctest.DocFileTest(
'tests.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
))
src/z/3/z3ext.content.ext.urlmapper-1.0.2/src/z3ext/content/ext/urlmapper/tests.py z3ext.content.ext.urlmapper(Download)
def test_suite():
return unittest.TestSuite((
doctest.DocFileTest(
'tests.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
))
src/m/e/mext.test-0.4.1.r2378/mext/test_suite.py mext.test(Download)
def add_doctest(self, name):
path = join(self.tests_dir, name + '.txt')
case = doctest.DocFileTest(
path,
module_relative=False,
optionflags=self.doctest_flags,
globs=self.doctest_globs
src/m/e/mechanize-HEAD/test-tools/unittest/loader.py mechanize(Download)
def maybe_load_doctest(path):
if path.endswith(".doctest"):
return doctest.DocFileTest(path, module_relative=False)
elif path.endswith("test_password_manager.special_doctest"):
# TODO: get rid of this
import mechanize
tests = []
common_globs = {"mechanize": mechanize}
for globs in [
{"mgr_class": mechanize.HTTPPasswordMgr},
{"mgr_class": mechanize.HTTPProxyPasswordMgr},
]:
globs.update(common_globs)
tests.append(doctest.DocFileTest(path, module_relative=False,
src/m/e/mechanize-0.2.2/test-tools/unittest/loader.py mechanize(Download)
def maybe_load_doctest(path):
if path.endswith(".doctest"):
return doctest.DocFileTest(path, module_relative=False)
elif path.endswith("test_password_manager.special_doctest"):
# TODO: get rid of this
import mechanize
tests = []
common_globs = {"mechanize": mechanize}
for globs in [
{"mgr_class": mechanize.HTTPPasswordMgr},
{"mgr_class": mechanize.HTTPProxyPasswordMgr},
]:
globs.update(common_globs)
tests.append(doctest.DocFileTest(path, module_relative=False,
src/a/f/afpy.xap-0.1/afpy/xap/tokenizer/tests.py afpy.xap(Download)
# module not available
return unittest.TestSuite(tests)
tests.append(doctest.DocFileTest('tokenizer.txt',
optionflags=doctest.ELLIPSIS))
return unittest.TestSuite(tests)
src/e/o/eol-HEAD/test/test_eol.py eol(Download)
def test_api(self):
if sys.version_info[:2] < (2,4):
raise TestSkipped("no DocFileTest in Python <=2.3")
test = doctest.DocFileTest("api.doctests")
test.runTest()
if sys.version_info[0] == 2:
def test_api2(self):
"""API tests for Python 2 syntax"""
if sys.version_info[:2] < (2,4):
raise TestSkipped("no DocFileTest in Python <=2.3")
test = doctest.DocFileTest("api2.doctests")
def test_api3(self):
"""API tests for Python 3 syntax"""
test = doctest.DocFileTest("api3.doctests")
test.runTest()
def test_internal(self):
import eol
1 | 2 Next