/
test_functional.py
73 lines (60 loc) · 2.5 KB
/
test_functional.py
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import os
import unittest
import textwrap
from nose.plugins import PluginTester
from nose.tools import eq_
from nosenicedots import NiceDots
def str_count(lines, chunk):
count = 0
for line in lines:
if chunk in line:
count += 1
return count
class NiceDotsTest(PluginTester):
activate = '--with-nicedots'
plugins = [NiceDots()]
suitepath = os.path.join(os.path.dirname(__file__), 'example-suite')
def makeSuite(self):
pass
class TestDefaults(NiceDotsTest, unittest.TestCase):
def test_suite(self):
print '>' * 80
print self.output
print '>' * 80
assert ('ERROR: nosenicedots/tests/example-suite/test_stuff/'
'test_classes.py:TestClass.test_error') in self.output
assert ('FAIL: nosenicedots/tests/example-suite/test_stuff/'
'test_classes.py:TestClass.test_failing') in self.output
assert ('nosenicedots/tests/example-suite/test_stuff/'
'test_classes.py:TestClass') in self.output
assert '..' in self.output
assert ('nosenicedots/tests/example-suite/test_stuff/'
'test_functions.py') in self.output
assert '..' in self.output
assert ('FAIL: nosenicedots/tests/example-suite/test_stuff/'
'test_functions.py:test_failing') in self.output
assert ('ERROR: nosenicedots/tests/example-suite/test_stuff/'
'test_functions.py:test_error') in self.output
assert ('SKIP: nosenicedots/tests/example-suite/test_stuff/'
'test_functions.py:test_skip') in self.output
assert ('nosenicedots/tests/example-suite/test_stuff/'
'test_generators.py') in self.output
# The summaries should be better:
assert ('FAIL: test_stuff.test_functions'
'.test_failing') not in self.output
# First for the early error, secondly for the summary:
eq_(str_count(self.output,
'FAIL: nosenicedots/tests/example-suite/test_stuff/'
'test_classes.py:TestClass.test_failing'),
2)
class TestQuietNiceDots(NiceDotsTest, unittest.TestCase):
args = ['--quiet-nice-dots']
def test_suite(self):
print '>' * 80
print self.output
print '>' * 80
# Summary should be hidden:
eq_(str_count(self.output,
'FAIL: nosenicedots/tests/example-suite/test_stuff/'
'test_classes.py:TestClass.test_failing'),
1)