1import os 2import sys 3import unittest 4 5from nose.plugins import PluginTester 6from nose.plugins.builtin import FailureDetail, Capture 7 8support = os.path.join(os.path.dirname(__file__), 'support') 9 10 11class TestFailureDetailWorks(PluginTester, unittest.TestCase): 12 activate = '-d' 13 plugins = [FailureDetail()] 14 args = ['-v'] 15 suitepath = os.path.join(support, 'issue072') 16 17 def test_assert_info_in_output(self): 18 print 19 print '!' * 70 20 print str(self.output) 21 print '!' * 70 22 print 23 assert '>> assert 4 == 2' in str(self.output) 24 25class TestFailureDetailWorksWhenChained(PluginTester, unittest.TestCase): 26 activate = '-d' 27 plugins = [FailureDetail(), Capture()] 28 args = ['-v'] 29 suitepath = os.path.join(support, 'issue072') 30 31 def test_assert_info_and_capt_stdout_in_output(self): 32 out = str(self.output) 33 print 34 print 'x' * 70 35 print out 36 print 'x' * 70 37 print 38 39 assert '>> assert 4 == 2' in out, \ 40 "Assert info not found in chained output" 41 assert 'something' in out, \ 42 "Captured stdout not found in chained output" 43 44if __name__ == '__main__': 45 unittest.main() 46