def test_fail_with_fatal(self): with patch("sys.stdout", new=StringIO()) as output: exited = False try: Log.fail("fail message", True) except SystemExit as e: if e.code == 10: exited = True self.assertIn("fail message", output.getvalue().strip()) self.assertEqual(exited, True)
def test_fail(self): with patch("sys.stdout", new=StringIO()) as output: Log.fail("fail message", False) self.assertIn("fail message", output.getvalue().strip())