def main(docstring): if python_version < 300: # # exception types are printed fully qualified in py3k # docstring = docstring.replace('Boost.Python.ArgumentError', 'ArgumentError') docstring = docstring.replace('Boost.Python.ArgumentError', 'ArgumentError') from doctest import Tester t = Tester(globs=globs) (failures, tries) = t.runstring(docstring, sys.argv[0]) t.summarize(verbose=1) sys.exit(failures > 0) else: import doctest parser = doctest.DocTestParser() dt = parser.get_doctest(docstring, globs=globs, name=sys.argv[0], filename=None, lineno=None) print(dt) runner = doctest.DocTestRunner(verbose=1) runner.run(dt) (failed, attempted) = runner.summarize(verbose=True) sys.exit(failed > 0)
if not quiet: print >> sys.stderr, "... Output will go to standard output" outstream = sys.stdout else: head, tail = os.path.split(filename) base, ext = os.path.splitext(tail) outname = "%s.%s" % (base, output_format) if not quiet: print >> sys.stderr, "... Output will go to", outname outstream = open(outname, "w") try: if output_format == "doctest": from doctest import Tester if not quiet: print >> sys.stderr, "*** Doctesting the document" t = Tester(globs={}, verbose=verbose) (fail, total) = t.runstring(open(filename).read(), filename) if not quiet and not verbose: print >> sys.stderr, "*** ", if fail: print "%d of" % fail, if total == 1: print "1 example", else: print "%d examples" % total, if fail: print "failed" else: print "passed" elif input_format == "text": if not quiet: print >> sys.stderr, "*** Making the document"
if not quiet: print >>sys.stderr, "... Output will go to standard output" outstream = sys.stdout else: head,tail = os.path.split(filename) base,ext = os.path.splitext(tail) outname = "%s.%s"%(base,output_format) if not quiet: print >>sys.stderr, "... Output will go to",outname outstream = open(outname,"w") try: if output_format == "doctest": from doctest import Tester if not quiet: print >>sys.stderr, "*** Doctesting the document" t = Tester(globs={},verbose=verbose) (fail,total) = t.runstring(open(filename).read(),filename) if not quiet and not verbose: print >>sys.stderr, "*** ", if fail: print "%d of"%fail, if total == 1: print "1 example", else: print "%d examples"%total, if fail: print "failed" else: print "passed" elif input_format == "text": if not quiet: print >>sys.stderr, "*** Making the document"