Questions tagged [coverage.py]

coverage.py is a tool for measuring test code coverage of Python programs

About

coverage.py is a tool for measuring test code coverage of Python programs. It monitors your program, noting which parts of the code have been executed, then analyzes the source to identify code that could have been executed but was not.
-- taken from https://coverage.readthedocs.io/

Install Instructions

You can install coverage.py with pip

$ pip install coverage

Usage

Run coverage.py with:

$ coverage run my_program.py arg1 arg2

Output looks like:

$ coverage report -m 
Name                      Stmts   Miss  Cover   Missing
-------------------------------------------------------
my_program                   20      4    80%   33-35, 39
my_other_module              56      6    89%   17-23
-------------------------------------------------------
TOTAL                        76     10    87%

Details can be found here.

472 questions
0
votes
1 answer

How do I run python code-coverage on multiple platforms

I am using coverage.py on my code (python 2.7), inside PyDEV on Windows. I have bits of code that run only on UNIX, usually starting with: if os.name == 'posix': and I want to make sure this is covered as well. Somehow to run coverage on UNIX, and…
ModdyFire
  • 706
  • 3
  • 9
  • 19
0
votes
1 answer

Why doesn't "coverage.py run -a" always increase my code coverage percent?

I have a GUI application that I am trying to determine what is being used and what isn't. I have a number of test suites that have to be run manually to test the user interface portions. Sometimes I run the same file a couple of times with…
tgbrooks
  • 241
  • 1
  • 10
-1
votes
1 answer

How can I use coverage to detect if a code execution would cover additional lines?

I recently became the maintainer of PyPDF2, a library for reading / writing PDF files. In order to get more confident/quick with merging PRs, I introduced quite a lot of tests. I use pytest and coverage to detect if I lack unit tests for some…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
-1
votes
1 answer

what does {} and format do in this command python?

Hi i am reading a source and it has a line: fn = 'total-listmix-{}-{}.xml'.format(opt.os, opt.compiler) exept Exception as e: raise Exception('error merging coverage: {}'.format(e)) I think the {} mean a dict but i do not understand what dict…
-2
votes
1 answer

Python module not found with sudo in github action

I wanted to use coveragepy combine to seperate .coverage files into one. For that I installed python and the coverage module via pip, afterwards then running this command. python -m coverage combine .coverage-*. That should work and does, but…
NLion74
  • 1
  • 4
1 2 3
31
32