Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JSON format to --cov-report #445

Open
pedrorrivero opened this issue Nov 22, 2020 · 7 comments
Open

Add JSON format to --cov-report #445

pedrorrivero opened this issue Nov 22, 2020 · 7 comments

Comments

@pedrorrivero
Copy link

Before proposing please consider:

  • the maintenance cost of the feature → probably not much if coverage.py is used
  • implementing it externally (like a shell/python script,
    pytest plugin or something else) → it is already implemented in coverage.py so it should not be too difficult to add

Summary

These questions should be answered:

  • why is the feature needed? User convenience
  • what problem does it solve? User friendly
  • how it is better compared to past solutions to the problem? JSON is easier to read than XML and more common
@hugovk
Copy link
Member

hugovk commented Nov 30, 2020

There's a suggestion in #337 that pytest-cov should do less, to simplify pytest-cov, and that coverage.py should be used for more things.

@pedrorrivero
Copy link
Author

I like what I read @hugovk, thanks for the heads-up!

@mwgamble
Copy link

Given that issue has been open for three and a half years with no traction, I think support for JSON should be implemented in this plugin. What kind of overhead is there? I'd be happy to do the work to contribute it.

@mwgamble
Copy link

Turns out the implementation wasn't very complicated, so I went ahead and did it: #582

I appreciate the points made in #337, but I think the consensus there is that the maintainers should build a new library that does less, rather than releasing a new major version of this library that's essentially a totally different project anyway. Therefore I think it's appropriate that straightforward modifications to expose additional trivial functionality in coverage.py should still be added to this project.

@pedrorrivero
Copy link
Author

Thansk a lot @mwgamble!

I agree with your assessment, especially after looking at your implementation (which is simple enough).

@nedbat
Copy link
Collaborator

nedbat commented Feb 27, 2023

Help me understand why running coverage json is difficult? You can already get a JSON report that way.

@mwgamble
Copy link

Help me understand why running coverage json is difficult?

  • It's an additional step. Having pytest just generate the JSON file automatically is much more convenient, for the same reasons anyone would already be using any of the other reporters by way of --cov-report.
  • It's not obvious to inexperienced developers why they can't run --cov-report=json when the coverage.py documentation is telling them JSON reporting is fully supported.

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

Successfully merging a pull request may close this issue.

4 participants