On Fri, Aug 22, 2008 at 09:31:07AM +1000, Ben Finney wrote:
> On 22-Aug-2008, Sami Liedes wrote:
> > If the profiled python script uses any .py files under
> > /usr/lib/python$VER/, the command "python-coverage -a" tries to write
> > in that directory (and if run as root, probably would succeed):
> 
> Yes, that's what the '-a' option is documented as doing. Its 
> documentation even gives an explicit way to avoid the behaviour you're 
> seeing: the '-d' option to specify a different directory for writing 
> the files.

Ah, in that case it's a man page bug. The man page doesn't mention -d.
Also I'd say it's somewhat surprising that it does it also for
system-provided files (definitely nothing in the man page hints that
it does):

------------------------------------------------------------
SYNOPSIS
       python-coverage -x module.py [ARG...]
       python-coverage -e
       python-coverage -r [-m]
       python-coverage -a [file...]

[...]

DESCRIPTION

       python-coverage executes a Python program and measures which of
       its statements are executed and which are not. It stores the
       information in the file .coverage in the current working
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       directory.
       ^^^^^^^^^

OPTIONS

       -e     Erase the .coverage file.

       -x     Execute a Python module, giving it the remaining command line
              arguments.

       -r     Produce a coverage report.

       -m     With -r, show the line numbers that were missed by the
              execution.

       -a     Annotate source files.  For each source file foo, produce
              foo,cover, with executed lines prefixed by ">" and non-executed
              by "!".

       --help Produce a help summary.  It might be more helpful than this
              manual page.


> =====
> $ python-coverage --help
> […]
> coverage.py -a [-d dir] [-o dir1,dir2,...] FILE1 FILE2 ...
>     Make annotated copies of the given files, marking statements that
>     are executed with > and statements that are missed with !.  With
>     the -d option, make the copies in that directory.  Without the -d
>     option, make each copy in the same directory as the original.
> =====

Didn't try that since I looked at the man page :)

        Sami



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to