Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

enable python coverage for subprocesses

Project Description

This package installs a pth file that enables the coveragepy process_startup feature in this python prefix/virtualenv in subsequent runs.



$ virtualenv tmpenv
$ . tmpenv/bin/activate
$ pip install coverage-enable-subprocess
$ touch .coveragerc
$ export COVERAGE_PROCESS_START=$PWD/.coveragerc
$ echo 'print("oh, hi!")' >
$ python
oh, hi!

$ coverage report
Name                              Stmts   Miss  Cover
/etc/python2.6/       5      1    80%                               1      0   100%
tmpenv/lib/python2.6/        433    392     9%
TOTAL                               439    393    10%

For projects that need to cd during their test runs, and run many processes in parallel, I ensure a $TOP variable is exported, and I use this .coveragerc:

parallel = True
branch = True
data_file = $TOP/.coverage

exclude_lines =
    # Have to re-enable the standard pragma

    # we can't get coverage for functions that don't return:
    \#.*never returns
    \#.*doesn't return

    # Don't complain if tests don't hit defensive assertion code:
    ^\s*raise Impossible\b
    ^\s*raise AssertionError\b
    ^\s*raise NotImplementedError\b
    ^\s*return NotImplemented\b

    # Don't complain if tests don't hit re-raise of unexpected errors:

    # if main is covered, we're good:
show_missing = True

directory = $TOP/coverage-html

# vim:ft=dosini
Release History

Release History

This version
History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
coverage_enable_subprocess-1.0-py2.py3-none-any.whl (4.0 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel May 11, 2016
coverage_enable_subprocess-1.0.tar.gz (2.7 kB) Copy SHA256 Checksum SHA256 Source May 11, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting