Skip to content

BUG: Reported coveralls coverage is for test files #155

@rstoneback

Description

@rstoneback

Describe the bug

The reported test coverage for the package is for the test files, not the source files.

To Reproduce

Steps to reproduce the behavior:

  1. Check out the details of the coveralls test coverage

Expected behavior

Test coverage should cover the source files. Apexpy's switch to Meson helped me get up to speed (with help from Meson) on OMMBV and Meson. Thank you! Since I didn't start from zero I was able to take an extra step and sort out source code coverage. I've included the OMMBV commands below to provide some assistance in return:

        rm -rf ./OMMBV 
        mkdir new_dir
        cd new_dir
        coverage run -m --source=OMMBV --omit=__init__.py pytest ../tests
        coverage report
        coverage xml
        mkdir ../OMMBV
        mv coverage.xml ../OMMBV/coverage.xml

So the --source term needs to be added so that the test coverage against the actual code files can be checked. Since both OMMBV and Apexpy have compiled Fortran, this means we need to get coveralls looking to the installed package, not the repo files on the file system. Note that --source looks to the filesystem first. Thus, I moved my test directory out of the source directory. Further, I removed the init.py from the unit test directory as this changes how pytest will set the python path. Since no local OMMBV directories were found the system used the installed OMMBV package.

One downside to this solution is that each installation is treated as separate by coveralls. This doesn't interfere with the reported % coverage but it is harder to click through to get the graphical display for each file's coverage line by line.

Image

Screenshots

Image

Computer

Coveralls and GitHub

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions