@@ -248,6 +248,25 @@ def test_annotate_output_dir(testdir):
248
248
assert result .ret == 0
249
249
250
250
251
+ def test_html (testdir ):
252
+ script = testdir .makepyfile (SCRIPT )
253
+
254
+ result = testdir .runpytest ('-v' ,
255
+ '--cov=%s' % script .dirpath (),
256
+ '--cov-report=html' ,
257
+ script )
258
+
259
+ result .stdout .fnmatch_lines ([
260
+ '*- coverage: platform *, python * -*' ,
261
+ 'Coverage HTML written to dir htmlcov' ,
262
+ '*10 passed*' ,
263
+ ])
264
+ dest_dir = testdir .tmpdir .join ('htmlcov' )
265
+ assert dest_dir .check (dir = True )
266
+ assert dest_dir .join ("index.html" ).check ()
267
+ assert result .ret == 0
268
+
269
+
251
270
def test_html_output_dir (testdir ):
252
271
script = testdir .makepyfile (SCRIPT )
253
272
@@ -288,6 +307,28 @@ def test_term_report_does_not_interact_with_html_output(testdir):
288
307
assert result .ret == 0
289
308
290
309
310
+ def test_html_configured_output_dir (testdir ):
311
+ script = testdir .makepyfile (SCRIPT )
312
+ testdir .tmpdir .join ('.coveragerc' ).write ("""
313
+ [html]
314
+ directory = somewhere
315
+ """ )
316
+ result = testdir .runpytest ('-v' ,
317
+ '--cov=%s' % script .dirpath (),
318
+ '--cov-report=html' ,
319
+ script )
320
+
321
+ result .stdout .fnmatch_lines ([
322
+ '*- coverage: platform *, python * -*' ,
323
+ 'Coverage HTML written to dir somewhere' ,
324
+ '*10 passed*' ,
325
+ ])
326
+ dest_dir = testdir .tmpdir .join ('somewhere' )
327
+ assert dest_dir .check (dir = True )
328
+ assert dest_dir .join ("index.html" ).check ()
329
+ assert result .ret == 0
330
+
331
+
291
332
def test_xml_output_dir (testdir ):
292
333
script = testdir .makepyfile (SCRIPT )
293
334
0 commit comments