I have a Python 2.7 method that sometimes calls
sys.exit(1)
Is it possible to make a unit test that verifies this line of code is called when
I found the answer to your question in the Python Unit Testing documentation search for "Testing for Exceptions". Using your example, the unit test would look like the following:
self.assertRaises(SystemExit, your_function, argument 1, argument 2)
Remember to include all arguments needed to test your function.