Skip to content

Coverage is no longer reported correctly when I register my project as a pytest plugin #397

Closed

Description

@retr0h

Summary

Coverage is no longer reported correctly when I register my project as a pytest plugin

Expected vs actual result

Coverage should not be impacted

Reproducer

Versions

  • pytest version 5.4.1
  • pytest-mock-2.0.0
  • pytest-cov-2.8.1

Config

[pytest]
testpaths = test/
addopts = -v -rxXs --doctest-modules --cov biased_utils --cov-report term-missing --showlocals
norecursedirs = dist doc build .tox .eggs

Code

When simply adding the following to my setup.cfg and execute tests, my coverage is completely thrown off. I have also removed the contents of biased_utils/hook/plugin.py, so it's simply loading the pytest11 entry point, and throwing off coverage.

[options.entry_points]
pytest11 =
    pytest11.biased_utils = biased_utils.hook.plugin
---------- coverage: platform darwin, python 3.7.3-final-0 -----------
Name                       Stmts   Miss  Cover   Missing
--------------------------------------------------------
biased_utils/__init__.py       6      6     0%   1-8
biased_utils/cli.py           12      8    33%   1-4, 16, 27, 40, 52-59
biased_utils/io.py             5      3    40%   1-5
biased_utils/yaml.py           9      5    44%   1-6, 15, 25
--------------------------------------------------------
TOTAL                         32     22    31%

However, if I remove that section from setup.cfg.

---------- coverage: platform darwin, python 3.7.3-final-0 -----------
Name                       Stmts   Miss  Cover   Missing
--------------------------------------------------------
biased_utils/__init__.py       6      0   100%
biased_utils/cli.py           12      2    83%   58-59
biased_utils/io.py             5      0   100%
biased_utils/yaml.py           9      0   100%
--------------------------------------------------------
TOTAL                         32      2    94%

Activity

  1. retr0h commented on Mar 19, 2020

    @retr0h
    Author

    Thanks @ionelmc

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