[Tutor] Fwd: Unittest traceback
Oleg Oltar
oltarasenko at gmail.com
Fri Apr 4 13:50:12 CEST 2008
---------- Forwarded message ----------
From: Oleg Oltar <oltarasenko at gmail.com>
Date: Fri, Apr 4, 2008 at 2:49 PM
Subject: Re: [Tutor] Unittest traceback
To: Kent Johnson <kent37 at tds.net>
Yes! Tried in command line. works fine there. Not sure howto customize my
IDE correctly. I use Emacs.
Thanks,
Oleg
On Fri, Apr 4, 2008 at 2:36 PM, Kent Johnson <kent37 at tds.net> wrote:
> Oleg Oltar wrote:
>
> > Hi!
> > I am trying to use unittest in python first time. But have a strange
> > traceback each time I run my sample tests.
> >
>
> How are you running the test? My guess is that you are running it in an
> IDE or something that shows the normal system exit exception.
>
> Calling sys.exit() raises the SystemExit exception with a result code.
> Normally this is not shown by the runner.
>
> In Python False == 0 so your program is exiting normally with a code of 0
> (no error). It is probably the program runner that is showing the traceback.
>
> Try running the program from the command line.
>
> Kent
>
>
> Can you please explain why I have it. No info about it in the doc. e.g.
> > the code is
> >
> > import unittest
> > import squaren
> >
> > class TestCases(unittest.TestCase):
> > def setUp(self):
> > pass
> >
> > def testsmall(self):
> > self.assertEqual(True, True)
> >
> >
> >
> > if __name__ == '__main__':
> > unittest.main()
> >
> > And the traceback is
> > ----------------------------------------------------------------------
> > Ran 1 test in 0.000s
> >
> > OK
> > Traceback (most recent call last):
> > File "/tmp/py359hJx", line 14, in <module>
> > unittest.main()
> > File "/opt/local/lib/python2.5/unittest.py", line 768, in __init__
> > self.runTests()
> > File "/opt/local/lib/python2.5/unittest.py", line 806, in runTests
> > sys.exit(not result.wasSuccessful())
> > SystemExit: False
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080404/794acccb/attachment.htm
More information about the Tutor
mailing list