It doesn't crash the Python interpreter, it terminates it. This is normal behavior for the script.
You can see it yourself: in main.py
it is stated, main = TestProgram
; this means that unittest.main()
will call the TestProgram
class, which in its __init__(self)
calls self.runTests()
, which ends with this:
if self.exit:
sys.exit(not self.result.wasSuccessful())
So it has a specific call to sys.exit()
, which terminates the interpreter.
In fact, if you run it as command line, you return to the command line; and if you start command-line Python, import the module and call the function, you will see that you'll return to the command prompt - you don't stay in Python.
If you want the script to NOT terminate the interpreter, just state it when calling the funcion:
unittest.main(exit=False)