Issue #269 invalid

coverage not work in subprocess mode

Anonymous created an issue

I have following simple codes:

#ex.py
import os, subprocess, shlex,time

def extest():
    cmd = 'python test.py'
    cmdlist = shlex.split(cmd)
    process = subprocess.Popen(cmdlist)

extest()

time.sleep(3)

print "ex---done"
#test.py:
print "test"

I set COVERAGE_PROCESS_START to .bashrc, and also insert following code to sitecustomize.py:

import coverage
coverage.process_startup()

after that, i run: coverage run --parallel -source=. ex.py I expect could get the report for both ex.py and test.py, however, none of them appear in the report ,instead, something like:

/usr/local/bin/coverage
/usr/share/pyshared/zope/__init__
...

appear in the report

what could be the reason?

Comments (4)

  1. Ned Batchelder repo owner

    COVERAGE_PROCESS_START should point to a .coveragerc file, not your .bashrc file, though I don't think that's the problem.

    Can you show the actual output from a terminal session that shows the contents of your files, and your command lines, the report output, etc?

  2. Ned Batchelder repo owner

    Actually, using a ticket for this is unlikely to work, esp since you are Anonymous. Can you send an email with the details, and we'll work through why your subprocess isn't being measured.

  3. Log in to comment