Skip to content

Provide a way for pytester to run coverage on plugins #675

Open
@pytestbot

Description

@pytestbot

Originally reported by: David MacIver (BitBucket: david_maciver_, GitHub: david_maciver_)


Scenario: I am writing a pytest plugin. I want to get coverage information on my plugin's execution.

Unfortunately right now this is hard. The problem is that because the plugin is run in a subprocess, it's not actually included in the coverage run, so all the code in my plugin reports as uncovered even if it's actually run.

To fix this right now I have to go through a bit of a song and dance to get coverage to automatically execute on all python subprocesses using a sitecustomize file or a .pth file, neither of which are ideal (they're quite hard to set up in my CI environment). It would be really helpful if I could configure pytester with a hook to execute before loading python so that coverage would be provided for the subprocesses as well.


Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: pytesterrelated to the pytester builtin plugintype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions