[Tutor] traceback

Kent Johnson kent37 at tds.net
Thu Jan 15 16:24:13 CET 2009

On Wed, Jan 14, 2009 at 12:09 PM, spir <denis.spir at free.fr> wrote:
> Hello,
> I rather often use exceptions as information providers at design or debug time. A typical use
> of mine is to have a test version of methods that wrap standard version:
> def run():
>        do stuff
>        that may
>        raise exc
> def testRun():
>        try:
>                run()
>        except Error,error:
>                sys.error.write(str(error))
> So that I can run a bunch of (possibly failing) tests and still get all worthful info.

You might be interested in the unittest module. It lets you create and
run a series of tests, some of which may fail, while reporting errors
in a useful way.

My introduction is here:


More information about the Tutor mailing list