Newer
Older
"""Run all doctests from modules on the command line. Use -v for verbose.
python doctests.py *.py
You can add more module-level tests with
__doc__ += "..."
You can add stochastic tests with
__doc__ += random_tests("...")
"""
if __name__ == "__main__":
modules = [__import__(name.replace('.py',''))
for arg in args if arg != "-v" for name in glob.glob(arg)]
for module in modules:
doctest.testmod(module, report=1)
print '%d failed out of %d' % doctest.master.summarize()