@@ -25,6 +25,11 @@ def test_foo():
25
25
assert False
26
26
'''
27
27
28
+ COVERAGERC_SOURCE = '''\
29
+ [run]
30
+ source = .
31
+ '''
32
+
28
33
SCRIPT_CHILD = '''
29
34
import sys
30
35
@@ -108,6 +113,47 @@ def test_central(testdir):
108
113
assert result .ret == 0
109
114
110
115
116
+ def test_central_nonspecific (testdir ):
117
+ script = testdir .makepyfile (SCRIPT )
118
+
119
+ result = testdir .runpytest ('-v' ,
120
+ '--cov' ,
121
+ '--cov-report=term-missing' ,
122
+ script )
123
+
124
+ result .stdout .fnmatch_lines ([
125
+ '*- coverage: platform *, python * -*' ,
126
+ 'test_central_nonspecific * %s *' % SCRIPT_RESULT ,
127
+ '*10 passed*'
128
+ ])
129
+
130
+ # multi-module coverage report
131
+ assert result .stdout .lines [- 3 ].startswith ('TOTAL ' )
132
+
133
+ assert result .ret == 0
134
+
135
+
136
+ def test_central_coveragerc (testdir ):
137
+ script = testdir .makepyfile (SCRIPT )
138
+ testdir .tmpdir .join ('.coveragerc' ).write (COVERAGERC_SOURCE )
139
+
140
+ result = testdir .runpytest ('-v' ,
141
+ '--cov' ,
142
+ '--cov-report=term-missing' ,
143
+ script )
144
+
145
+ result .stdout .fnmatch_lines ([
146
+ '*- coverage: platform *, python * -*' ,
147
+ 'test_central_coveragerc * %s *' % SCRIPT_RESULT ,
148
+ '*10 passed*' ,
149
+ ])
150
+
151
+ # single-module coverage report
152
+ assert result .stdout .lines [- 3 ].startswith ('test_central_coveragerc ' )
153
+
154
+ assert result .ret == 0
155
+
156
+
111
157
def test_no_cov_on_fail (testdir ):
112
158
script = testdir .makepyfile (SCRIPT_FAIL )
113
159
0 commit comments