@@ -150,7 +150,8 @@ def test_foo(cov):
150
150
CHILD_SCRIPT_RESULT = '[56] * 100%'
151
151
PARENT_SCRIPT_RESULT = '9 * 100%'
152
152
DEST_DIR = 'cov_dest'
153
- REPORT_NAME = 'cov.xml'
153
+ XML_REPORT_NAME = 'cov.xml'
154
+ LCOV_REPORT_NAME = 'cov.info'
154
155
155
156
xdist_params = pytest .mark .parametrize ('opts' , [
156
157
'' ,
@@ -333,18 +334,50 @@ def test_xml_output_dir(testdir):
333
334
334
335
result = testdir .runpytest ('-v' ,
335
336
'--cov=%s' % script .dirpath (),
336
- '--cov-report=xml:' + REPORT_NAME ,
337
+ '--cov-report=xml:' + XML_REPORT_NAME ,
337
338
script )
338
339
339
340
result .stdout .fnmatch_lines ([
340
341
'*- coverage: platform *, python * -*' ,
341
- 'Coverage XML written to file ' + REPORT_NAME ,
342
+ 'Coverage XML written to file ' + XML_REPORT_NAME ,
342
343
'*10 passed*' ,
343
344
])
344
- assert testdir .tmpdir .join (REPORT_NAME ).check ()
345
+ assert testdir .tmpdir .join (XML_REPORT_NAME ).check ()
345
346
assert result .ret == 0
346
347
347
348
349
+ @pytest .mark .skipif ("coverage.version_info < (6, 3)" )
350
+ def test_lcov_output_dir (testdir ):
351
+ script = testdir .makepyfile (SCRIPT )
352
+
353
+ result = testdir .runpytest ('-v' ,
354
+ '--cov=%s' % script .dirpath (),
355
+ '--cov-report=lcov:' + LCOV_REPORT_NAME ,
356
+ script )
357
+
358
+ result .stdout .fnmatch_lines ([
359
+ '*- coverage: platform *, python * -*' ,
360
+ 'Coverage LCOV written to file ' + LCOV_REPORT_NAME ,
361
+ '*10 passed*' ,
362
+ ])
363
+ assert testdir .tmpdir .join (LCOV_REPORT_NAME ).check ()
364
+ assert result .ret == 0
365
+
366
+
367
+ @pytest .mark .skipif ("coverage.version_info >= (6, 3)" )
368
+ def test_lcov_not_supported (testdir ):
369
+ script = testdir .makepyfile ("a = 1" )
370
+ result = testdir .runpytest ('-v' ,
371
+ '--cov=%s' % script .dirpath (),
372
+ '--cov-report=lcov' ,
373
+ script ,
374
+ )
375
+ result .stderr .fnmatch_lines ([
376
+ '*argument --cov-report: LCOV output is only supported with coverage.py >= 6.3' ,
377
+ ])
378
+ assert result .ret != 0
379
+
380
+
348
381
def test_term_output_dir (testdir ):
349
382
script = testdir .makepyfile (SCRIPT )
350
383
0 commit comments