Tests succeed, still get traceback

To avoid the end of execution traceback:

if __name__ == '__main__':
    unittest.main(exit=False)

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!