Skip to content

Parsing coverage output with --cov-fail-under failure results in extra rows #98

@adborden

Description

@adborden

I'm running our coverage tests with --cov-fail-under in order to fail the tests unless a minimum threshold of coverage is met. When the threshold isn't met, a failure message is included in the output which seems to confuse the parser.

Output from terminal:

================================= test session starts =================================
platform linux -- Python 3.8.7, pytest-4.6.5, py-1.10.0, pluggy-0.13.1
rootdir: /app, inifile: setup.cfg
plugins: ckan-0.0.12, rerunfailures-8.0, split-tests-1.0.9, Faker-6.5.0, cov-2.7.1, pyfakefs-3.2, freezegun-0.4.1
collected 12 items

ckanext/datagovtheme/tests/test_datagovtheme.py .....                           [ 41%]
ckanext/datagovtheme/tests/test_helpers.py ...                                  [ 66%]
ckanext/datagovtheme/tests/test_notes.py .                                      [ 75%]
ckanext/datagovtheme/tests/test_ui_data.py ...                                  [100%]

----------- coverage: platform linux, python 3.8.7-final-0 -----------
Name                                            Stmts   Miss  Cover
-------------------------------------------------------------------
ckanext/datagovtheme/__init__.py                    6      3    50%
ckanext/datagovtheme/controllers.py                21     21     0%
ckanext/datagovtheme/dynamic_menu/__init__.py       0      0   100%
ckanext/datagovtheme/helpers.py                   372    275    26%
ckanext/datagovtheme/plugin/__init__.py            37     15    59%
ckanext/datagovtheme/plugin/flask_plugin.py         6      0   100%
ckanext/datagovtheme/plugin/pylons_plugin.py        6      6     0%
-------------------------------------------------------------------
TOTAL                                             448    320    29%

FAIL Required test coverage of 40% not reached. Total coverage: 28.57%

====================== 12 passed, 565 warnings in 82.77 seconds =======================

Markdown posted to PR:

### :white_check_mark: Result of Pytest Coverage

----------- coverage: platform linux, python 3.8.7-final-0 -----------
| Name | Stmts | Miss | Cover |
| :--- | ----: | ---: | ----: |
| ckanext/datagovtheme/__init__.py| 6| 3| 50%|
| ckanext/datagovtheme/controllers.py| 21| 21| 0%|
| ckanext/datagovtheme/dynamic_menu/__init__.py| 0| 0| 100%|
| ckanext/datagovtheme/helpers.py| 372| 275| 26%|
| ckanext/datagovtheme/plugin/__init__.py| 37| 15| 59%|
| ckanext/datagovtheme/plugin/flask_plugin.py| 6| 0| 100%|
| ckanext/datagovtheme/plugin/pylons_plugin.py| 6| 6| 0%|
| TOTAL| 448| 320| 29%|
| Required| test| coverage| of|
| ===================| 12| passed,| 565|

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions