@@ -476,6 +476,39 @@ def test_cov_min_float_value_not_reached_cli(testdir):
476
476
result .stdout .fnmatch_lines (['FAIL Required test coverage of 88.89% not reached. Total coverage: 88.89%' ])
477
477
478
478
479
+ def test_cov_precision (testdir ):
480
+ script = testdir .makepyfile (SCRIPT )
481
+ result = testdir .runpytest ('-v' , f'--cov={ script .dirpath ()} ' , '--cov-report=term-missing' , '--cov-precision=6' , script )
482
+ assert result .ret == 0
483
+ result .stdout .fnmatch_lines (
484
+ [
485
+ 'Name Stmts Miss Cover Missing' ,
486
+ '----------------------------------------------------------' ,
487
+ 'test_cov_precision.py 9 1 88.888889% 11' ,
488
+ '----------------------------------------------------------' ,
489
+ 'TOTAL 9 1 88.888889%' ,
490
+ ]
491
+ )
492
+
493
+
494
+ def test_cov_precision_from_config (testdir ):
495
+ script = testdir .makepyfile (SCRIPT )
496
+ testdir .tmpdir .join ('pyproject.toml' ).write ("""
497
+ [tool.coverage.report]
498
+ precision = 6""" )
499
+ result = testdir .runpytest ('-v' , f'--cov={ script .dirpath ()} ' , '--cov-report=term-missing' , script )
500
+ assert result .ret == 0
501
+ result .stdout .fnmatch_lines (
502
+ [
503
+ 'Name Stmts Miss Cover Missing' ,
504
+ '----------------------------------------------------------------------' ,
505
+ 'test_cov_precision_from_config.py 9 1 88.888889% 11' ,
506
+ '----------------------------------------------------------------------' ,
507
+ 'TOTAL 9 1 88.888889%' ,
508
+ ]
509
+ )
510
+
511
+
479
512
def test_cov_min_no_report (testdir ):
480
513
script = testdir .makepyfile (SCRIPT )
481
514
0 commit comments