summaryrefslogtreecommitdiff
path: root/functional_tests/test_failuredetail_plugin.py
blob: 284cf4930b60e5dfe0fd83203991393bfb44995b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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()