def test_pretty_patch_script_error(self): # FIXME: This is some ugly white-box test hacking ... port = Port(executive=executive_mock.MockExecutive2(exception=ScriptError)) port._pretty_patch_available = True self.assertEqual(port.pretty_patch_text("patch.txt"), port._pretty_patch_error_html) # This tests repeated calls to make sure we cache the result. self.assertEqual(port.pretty_patch_text("patch.txt"), port._pretty_patch_error_html)
def test_pretty_patch_script_error(self): # FIXME: This is some ugly white-box test hacking ... port = Port(executive=executive_mock.MockExecutive2( exception=ScriptError)) port._pretty_patch_available = True self.assertEqual(port.pretty_patch_text("patch.txt"), port._pretty_patch_error_html) # This tests repeated calls to make sure we cache the result. self.assertEqual(port.pretty_patch_text("patch.txt"), port._pretty_patch_error_html)
def test_pretty_patch_os_error(self): port = Port(executive=executive_mock.MockExecutive2(exception=OSError)) oc = outputcapture.OutputCapture() oc.capture_output() self.assertEqual(port.pretty_patch_text("patch.txt"), port._pretty_patch_error_html) # This tests repeated calls to make sure we cache the result. self.assertEqual(port.pretty_patch_text("patch.txt"), port._pretty_patch_error_html) oc.restore_output()