Ich hab mit das gebastelt:
Code: Alles auswählen
SKIP_DIRS = (".settings", ".git", "dist", "python_creole.egg-info")
SKIP_FILES = ("setup.py", "test.py")
def run_all_doctests():
for root, dirs, filelist in os.walk("../", followlinks=True):
for skip_dir in SKIP_DIRS:
if skip_dir in dirs:
dirs.remove(skip_dir) # don't visit this directories
for filename in filelist:
if not filename.endswith(".py"):
continue
if filename in SKIP_FILES:
continue
sys.path.insert(0, root)
m = __import__(filename[:-3])
del sys.path[0]
failed, attempted = testmod(m)
if attempted and not failed:
filepath = os.path.join(root, filename)
print "DocTest in %s OK (failed=%i, attempted=%i)" % (
filepath, failed, attempted
)
DocTest in ../tests/test_macros.py OK (failed=0, attempted=4)
DocTest in ../tests/utils/base_unittest.py OK (failed=0, attempted=2)
DocTest in ../creole/html_parser/parser.py OK (failed=0, attempted=3)
DocTest in ../creole/rest2html/clean_writer.py OK (failed=0, attempted=1)
DocTest in ../creole/shared/document_tree.py OK (failed=0, attempted=4)
DocTest in ../creole/creole2html/parser.py OK (failed=0, attempted=3)
DocTest in ../creole/creole2html/rules.py OK (failed=0, attempted=3)
DocTest in ../creole/creole2html/str2dict.py OK (failed=0, attempted=4)
**********************************************************************
File "../creole/html_tools/strip_html.py", line 59, in strip_html.strip_html
Failed example:
strip_html(u'<strong>foo</strong>\n<ul><li>one</li></ul>')
Expected:
u'<strong>foo</strong><ul><li>one</li></ul>'
Got:
u'<strong>foo</strong> <ul><li>one</li></ul>'
**********************************************************************
1 items had failures:
1 of 7 in strip_html.strip_html
***Test Failed*** 1 failures.
DocTest in ../creole/html_tools/text_tools.py OK (failed=0, attempted=4)
DocTest in ../creole/html_tools/deentity.py OK (failed=0, attempted=6)
Das muß doch irgendwie einfacher gehen, oder?