[TIP] py.test coverage without erasing coverage data on previous runs?

Ben Finney ben+python at benfinney.id.au
Mon Mar 23 14:47:23 PDT 2015

Randy Syring <randy at thesyrings.us> writes:

> However, I'd like to accumulate coverage over multiple calls in my
> tox.ini so that I can get a coverage number that is reflective of all
> python versions I'm testing against. Can I get pytest-cov to not erase
> the coverage?

(Caveat: I'm not using pytest, nor tox. I just run the appropriate
Coverage runner directly.)

Here is how I accumulate coverage data across different test runs for
the same purpose you describe.

    for py_ver in 2 3 ; do
        python${py_ver}-coverage run --branch --parallel-mode ./setup.py test -q

    python3-coverage combine
    python3-coverage report foo/ bar/

 \       “Try to learn something about everything and everything about |
  `\                                  something.” —Thomas Henry Huxley |
_o__)                                                                  |
Ben Finney

More information about the testing-in-python mailing list