coverage of (sub)processes without setting COVERAGE_PROCESS_START env

Issue #344 invalid
Tim Tisdall created an issue

I may just be doing something wrong here so I apologize if this isn't a real issue, but something is definitely not working correctly.

To start with, I posted this question which Ned answered:

I changed my to be:

import coverage

... because I didn't want to be running coverage during normal usage. My understanding from the docs is that it shouldn't do anything unless it finds the COVERAGE_PROCESS_START environment variable. However when I try to kill my program that's running as user www-data I get the following error:

Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/sites/metrics_dev/env/lib/python3.4/site-packages/coverage/", line 417, in _atexit
  File "/sites/metrics_dev/env/lib/python3.4/site-packages/coverage/", line 493, in save
  File "/sites/metrics_dev/env/lib/python3.4/site-packages/coverage/", line 91, in write
  File "/sites/metrics_dev/env/lib/python3.4/site-packages/coverage/", line 131, in write_file
    fdata = open(filename, 'wb')
PermissionError: [Errno 13] Permission denied: '/'

This indicates that it's trying to write coverage details to a file even though I haven't set the environment variable. Originally I thought this was due to a cached .pyc file in pycache but after deleting that I'm still getting that error message.

Comments (1)

  1. Tim Tisdall reporter

    I found where it was setting the environment variable! Sorry!

    I'm still having an issue with getting to track code usage in the sub-process though... it outputs with the print statements but coverage doesn't see that it's running those commands.

  2. Log in to comment