FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

codecov exclude_lines · Issue #152 · codecov/codecov-python · GitHub

This repository was archived by the owner on May 21, 2025. It is now read-only.

Repository navigation

This repository was archived by the owner on May 21, 2025. It is now read-only.

codecov exclude_lines #152

Description

Hello!
I am trying to exclude code in the tox report, from what I gathered online I am trying to use the following in my tox.ini file:

[report]
exclude_lines=
    pragma: no cover
    pragma: ${MYSQL_TESTS} cover

But it doesn't seem to work, especially for the environment variable (spawning a docker container where I run all tests), for example MYSQL_TESTS=NO.

On my code i have it something like

  • for env. variable pragma, expecting the whole function/class to be excluded:
def foo(params):  # NO cover
    ...
  • for normal pragma, expecting the whole function/class to be excluded:
def foo(params):  # no cover
    ...

Some modules dont have to be tested, when another module is being tested, and I am trying to exclude them from the final report (when I test for mongo, dont include sql code in the coverage report).

This report right here:

The way I run my tests is:

[tox]
envlist = py36
setupdir = /app/src/

[testenv]
passenv = *

deps =
        --upgrade
        -r/app/src/requirements.txt
        -r/app/tests/requirements.txt

commands =
        nosetests -w /app/tests --with-xunit --xunit-file=/output/nosetests.xml \
            --with-coverage --cover-erase \
            --cover-package=adapters --cover-package=esm \
            --cover-min-percentage=70
        codecov -e TOXENV

Could someone help me out please? Am i setting this wrong?

Activity

  1. Ademord commented on Jun 13, 2018

    Author

    So I managed to get it working by using:

    [coverage:report] 
    exclude_lines=
        pragma: no cover
        pragma: ${MYSQL_TESTS} cover
    
    

    Since I am reading the config out of a tox.ini, i need the "coverage" prefix. It is important 😄!

  2. ssbarnea commented on Nov 26, 2022

    I do have the impression that now codecov is failing to load the same settings from pyproject.toml. https://github.com/ansible/ansible-lint/blob/main/pyproject.toml#L13-L24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL