Expose Coverage's --sort as --cov-sort pytest option
See original GitHub issueSummary
A useful feature of Coverage is to sort the report by the reported metrics (docs), rather than just by filename. Especially in legacy or unfamiliar code, sorting by branch
or cover
helps in trying to understand the areas of risk. It would be helpful to expose this option as one of the flags pytest-cov
can pass along to Coverage here.
In a tox
project using setup.cfg
, for example, the only alternative (I know of) is to set the sorting in the Coverage section, but this imposes a particular sorting and isn’t as easy to change quickly, and might become a source of accidental diffs when left changed.
I’d be happy to open a pull request to this effect, but wanted to start with some discussion first 😄
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:7
Top Results From Across the Web
Reporting — pytest-cov 4.0.0 documentation - Read the Docs
It is possible to generate any combination of the reports for a single test run. The available reports are terminal (with or without...
Read more >pytest - Python click sample code test case does not give 100 ...
The code works correctly. $ export PYTHONPATH=. $ python commands/cmd.py Usage: cmd.py [OPTIONS] COMMAND [ARGS]... Options ...
Read more >PyCharm - Run/Debug Configuration: pytest - JetBrains
The plugin coverage for pytest, due to technical restrictions, breaks PyCharm's ... Options. Publish all ports: Expose all container ports to the host....
Read more >Effective Python Testing With Pytest
Most functional tests follow the Arrange-Act-Assert model: Arrange, or set up, the conditions for the test; Act by calling some function or ...
Read more >testmon: About
pytest -testmon is a pytest plugin which executes only tests you need to run. It collects dependencies between tests and executed code.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Another option is to simply use the
coverage report
command instead of having pytest-cov do the reporting. There’s no need for the reporting to happen in the pytest plugin.@nedbat Maybe I didn’t explain super well; I like to have coverage run as part of just running
tox
, and could do that with two sequentialcommands
, but ad hoc I like to change the sorting for a better view of things, and don’t like to fiddle withsetup.cfg
to do it. This is purely a convenience request. I could also really be missing something 😄