awips2/pythonPackages/nose/functional_tests/test_failuredetail_plugin.py
root 9f19e3f712 Initial revision of AWIPS2 11.9.0-7p5
Former-commit-id: 64fa9254b946eae7e61bbc3f513b7c3696c4f54f
2012-01-06 08:55:05 -06:00

50 lines
1.2 KiB
Python
Executable file

import os
import sys
import unittest
from nose.plugins.failuredetail import FailureDetail
from nose.plugins.capture import Capture
from nose.plugins import PluginTester
support = os.path.join(os.path.dirname(__file__), 'support')
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
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
if __name__ == '__main__':
unittest.main()