def test_formatFailure(self): class DummyError(Exception): pass try: raise DummyError except DummyError: exc_info = sys.exc_info() plug = FailureDetail() (ec, ev, tb) = plug.formatFailure(self, exc_info) assert exc_info[0] is ec assert exc_info[2] is tb assert self.tbinfo is not None exc_info = (exc_info[0], exc_info[1], None) # Try without traceback (ec, ev, tb) = plug.formatFailure(self, exc_info) assert self.tbinfo is None
class TestFailureDetailWithUnicodeAndCapture(PluginTester, unittest.TestCase): activate = "-d" args = ['-v'] plugins = [FailureDetail(), Capture()] suitepath = os.path.join(support, 'issue720') def runTest(self): print '*' * 70 print str(self.output) print '*' * 70 assert 'UnicodeDecodeError' not in self.output assert 'UnicodeEncodeError' not in self.output
class TestFailureDetailWithCapture(PluginTester, unittest.TestCase): activate = "-d" args = ['-v'] plugins = [FailureDetail(), Capture()] suitepath = os.path.join(support, 'fdp/test_fdp_no_capt.py') def runTest(self): print '*' * 70 print str(self.output) print '*' * 70 expect = \ 'AssertionError: a is not 4\n' ' print "Hello"\n' ' 2 = 2\n' '>> assert 2 == 4, "a is not 4"' assert expect in self.output
class TestFailureDetail(PluginTester, unittest.TestCase): activate = "-d" args = ['-v'] plugins = [FailureDetail()] suitepath = os.path.join(support, 'fdp') def runTest(self): print('*' * 70) print(str(self.output)) print('*' * 70) expect = \ 'AssertionError: a is not 4\n' ' print "Hello"\n' ' 2 = 2\n' '>> assert 2 == 4, "a is not 4"' assert expect in self.output