[TIP] coverage for any python process that run (regardless of user)
ned at nedbatchelder.com
Wed Feb 1 16:46:19 PST 2012
On 2/1/2012 7:07 PM, Dustin Lee wrote:
> I'm attempting to set up coverage to run for *any* python process that
> runs on a specific server.
> currently I have the following in sitecustomize.py
> import os
> import sys
> import coverage
> The problem is that some of the processes run as root and some run as
> particular users. This was causing the non-root processes to fail due
> to the fact that they couldn't write to the .coverage file.
> Is there some way to automagically open up .coverage to be writable by
> anything? (Does coverage manage perms at all or should I just do this
> with umask maybe? (I don't want to mess with this and change how
> particular programs behave))
Coverage.py does no manipulation of permissions for the data file. It
tries to write it, and either can or can't. You'll have to use the OS
tools to make sure it can.
> Is there some easy way to have each process write to a different file
> so they don't stomp on each other? I see there is a --parallel-mode
> switch but is there a way to set this up automatically? My goal is to
> have ALL processes run coverage.py nolens volens.
I would think parallel mode is exactly what you want. You can enable it
in the .coveragerc file with: [run]\n parallel=True
> Dustin Lee
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python