31
from optparse import OptionParser
32
parser = OptionParser(
33
usage="usage: %prog [options] MODULE_NAME [MODULE_NAME ...]")
34
format_choices = sorted(formats.keys())
35
parser.add_option("-f", "--format", dest="format",
36
choices=format_choices, metavar="FORMAT",
37
help="Format to emit. One of: " + ', '.join(format_choices),
43
'moin': formatter.WikiFormatter,
44
'rest': formatter.ReSTFormatter,
45
'shiny': formatter.ShinyFormatter,
31
if len(sys.argv) != 2:
35
module = string_to_module(sys.argv[1])
39
format = formatter.WikiFormatter(sys.stdout)
50
parser = make_options()
51
(options, args) = parser.parse_args()
52
format = formats[options.format](sys.stdout)
40
53
doc = documenter.Documenter(format)
41
finder.find_tests(doc, module)
55
module = string_to_module(arg)
57
finder.find_tests(doc, module)
60
if e.errno == getattr(errno, 'EPIPE', None):
61
sys.stderr.write('testdoc: broken pipe\n')
44
66
if __name__ == '__main__':