[EMAIL PROTECTED] wrote: > Can I somehow tell doctest that it's time to quit?
Hit Ctrl-C. Or raise a KeyboardInterrupt: import sys class ExitDoctest(KeyboardInterrupt): pass def f(what): """ >>> f("alpha") 'alpha' >>> f("e") 'e' >>> f("x") 'x' >>> f("X") 'X' >>> f("beta") 'beta' """ if what == "e": raise Exception elif what == "x": sys.exit() elif what == "X": raise ExitDoctest("You're in trouble") return what if __name__ == "__main__": import doctest try: doctest.testmod() except ExitDoctest, e: print >> sys.stderr, e Peter -- http://mail.python.org/mailman/listinfo/python-list