Paul Manta Paul Manta - 2 years ago 102
Python Question

Tests succeed, still get traceback

I'm using Python's

library and all the tests succeed, but I still get a traceback and I can't understand how I can fix the problem.

Ran 8 tests in 0.020s


Traceback (most recent call last):
File "C:\Users\Paul\Desktop\bloomfilter\", line 85, in <module>
File "C:\Programming\PythonX86\Python27\lib\unittest\", line 95, in __init__
File "C:\Programming\PythonX86\Python27\lib\unittest\", line 231, in runTests
sys.exit(not self.result.wasSuccessful())
SystemExit: False

Answer Source

It appears that you are running in the Python shell, which catches exceptions for you so you can continue debugging. If you had been running from the command line, the line

sys.exit(not self.result.wasSuccessful())

would have exited your program with an exit code of 0, which indicates success (this might be counterintuitive if you're unfamiliar with how programs interact with the shell). Since you're running in the interpreter, however, the exception is caught.

I would suggest that there is nothing wrong with your program or your tests. The unittests framework probably just didn't expect to be run interactively!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download