diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-03-29 17:42:45 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-03-29 17:42:45 -0400 |
commit | 5ed649e55e14f7c8cd7a693f3d1fff966283c68d (patch) | |
tree | 903086463fcf1d9a6712565e2ca4db14b78023e0 | |
parent | fa22473c99e37399a83ea074b6528fa9496bb038 (diff) | |
parent | 8312d5fdf8928d04b0d3fd2856b88d3c2cc0cb58 (diff) | |
download | python-coveragepy-git-5ed649e55e14f7c8cd7a693f3d1fff966283c68d.tar.gz |
Automated merge with ssh://bitbucket.org/ned/coveragepy
-rw-r--r-- | doc/subprocess.rst | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/doc/subprocess.rst b/doc/subprocess.rst index 9e223d8e..15fa4c22 100644 --- a/doc/subprocess.rst +++ b/doc/subprocess.rst @@ -26,9 +26,19 @@ multiple coverage.py runs will each write their data to a distinct file. Configuring Python for subprocess coverage ------------------------------------------ -To measure coverage in subprocesses, you have to do two things: set a value for -the ``COVERAGE_PROCESS_START`` environment variable, and then invoke -:func:`coverage.process_startup`. +Measuring coverage in subprocesses is a little tricky. When you spawn a +subprocess, you are invoking Python to run your program. Usually, to get +coverage measurement, you have to use coverage.py to run your program. +Your subprocess won't be using coverage.py, so we have to convince Python +to use coverage even when not explicitly invokved. + +To do that, we'll configure Python to run a little coverage.py code when it +starts. That code will look for an environment variable that tells it to +start coverage measurement at the start of the process. + +To arrange all this, you have to do two things: set a value for the +``COVERAGE_PROCESS_START`` environment variable, and then configure Python to +invoke :func:`coverage.process_startup` when Python processes start. How you set ``COVERAGE_PROCESS_START`` depends on the details of how you create subprocesses. As long as the environment variable is visible in your subprocess, |