How to get around "sys.exit()" in python nosetest?
How to get around "sys.exit()" in python nosetest? Question: It seems that python nosetest will quit when encountered sys.exit(), and mocking of this builtin doesn’t work. Asked By: Hailiang Zhang || Source Answers: You can try catching the SystemExit exception. It is raised when someone calls sys.exit(). with self.assertRaises(SystemExit): myFunctionThatSometimesCallsSysExit() Answered By: kichik import sys …