It seems that python nosetest will quit when encountered "sys.exit()", and mocking of this built-in doesn't work. Thanks for suggestions.
You can try catching the SystemExit exception. It is raised when someone calls sys.exit()
.
with self.assertRaises(SystemExit):
myFunctionThatSometimesCallsSysExit()