I'm attempting to write a test suite which doesn't exit on failure. Take the following example:
class MyTestSuite(unittest.TestCase):
def test_foo(self):
self.assert_equal(1, 2)
print('bar')
self.assert_equal(5, 5)
if __name__ == "__main__":
unittest.main(failfast=False, exit=False)
'bar' isn't printed due to the first assertion failing.
How do I prevent unittest exiting on failure?
Research
failfast=Truecauses the whole test run to quit on a failure and defaults toFalseso this doesn't help.- According to the docs
exit=Falsedoesn't help as it simply switches between standard output and callingsys.exit(). - It looks like I may need to override the
unittestpackage but where to start?
Aucun commentaire:
Enregistrer un commentaire