to Doctest as SystemExit is to Python
p.lavarre at ieee.org
p.lavarre at ieee.org
Fri Nov 10 10:17:55 EST 2006
(((I thought I had sent this reply already, Google says No.)))
> > Can I somehow tell doctest that it's time to quit?
> > ... doctest redefines ... SystemExit ...
>
> Hit Ctrl-C. Or raise a KeyboardInterrupt:
Yes! Thank you!!! I see now,
Doctest exactly reverses the python -i experience:
doctest exits quietly if I raise KeyboardInterrupt.
doctest catches SystemExit and prints the traceback.
python -i exits quietly if I raise SystemExit.
python -i catches KeyboardInterrupt and prints the traceback.
Of course, to make the doctest work as sketched, I had to strip the
trailing blanks that my browser introduced and I had to expect
tracebacks for raise Exception and raise SystemExit, e.g.:
>>> import sys
>>> sys.exit()
Traceback (most recent call last):
...
SystemExit
>>>
More information about the Python-list
mailing list