Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 29 lines (21 sloc) 0.567 kb
#! /usr/bin/env python
"""Utility to run doctests in a python script.
Usage:
$ doctest script.py
"""
import doctest
import os.path
def test(filename, verbose=False):
base, ext = os.path.splitext(filename)
name = base.replace(os.path.sep, '.')
mod = __import__(name, None, None, ['x'])
doctest.testmod(mod, verbose=verbose)
if __name__ == "__main__":
import sys
sys.path.insert(0, '.')
if '-v' in sys.argv:
sys.argv.remove('-v')
verbose = True
else:
verbose = False
test(sys.argv[1], verbose)
Jump to Line
Something went wrong with that request. Please try again.