PYCOVER(1) User Commands PYCOVER(1)
NAME
pycover - generate coverage information for python programs
pyviewc - coverage data viewer
SYNOPSYS
pycover [python program] [python program args]
pyviewc [-i file] [--input=file] [files...]
DESCRIPTION
These programs generate and view coverage information for
python programs. The pycover program generates the coverage
information and places it in a file named coverage.dat by
default. The pyviewc takes the generated information and
outputs the source files with the coverage information into
a file in the current working directory with the name
file.covered.
If the first character on an line in the file.covered file
is a `!', the line has not been executed. If it has been
executed, it will have a '>' as the first character on the
line. If the line is a whole line comment or a blank line,
it will have a space as the first character on the line.
There are times that using pycover by itself can be a bit
difficult (e.g. CGIs) so there is an alternative way of
invoking the coverage data generator. The following code,
if placed in your main section will generate the appropriate
coverage data:
import pycoverfuncs
pycoverfuncs.cover(filename)
Call your main function here
The main caveat here is that any code that follows in the
block you put this in will probably not be analyzed.
OPTIONS
-i, --input=file
For pyviewc, read coverage data from the file instead
of the default location.
ENVIRONMENT VARIABLES
If the PYCOVERFILE environment variable is defined, pycover
and pyviewc will use that filename as the file to put/get
coverage information to/from (unless the -i or --input
switches have been specified).
SunOS 5.5.1 Last change: 1
PYCOVER(1) User Commands PYCOVER(1)
EXAMPLES
To run a program and produce coverage information is:
pycover programname programargs
To view coverage output, type:
pyviewc
and it will produce a python_source_file.covered file in the
current directory that has the aforementioned format for
each source file that it can find. By default, it excludes
files in /usr/local and pycoverfuncs.py.
BUGS
+ Currently, pyviewc does not mark the second and
subsequent lines of multi-line statements (i.e.
triple-quoted strings, dictionaries) as having been
executed if the first line has been executed. If
anyone has ideas on how to reliably fix this, it
would be most appreciated.
TODO
Needs more features. A GUI viewer would be way-cool. A
more configurable way of specifying files to be excluded by
pyviewc would be good too (perhaps a configuration file or
multiple cmd line args?).
Integration with pdb or with the profiler would be neat
also.
SEE ALSO
python(1)
AUTHOR
Andrew Csillag, Prodigy Inc. <
[email protected]>
PyCover Home page:
http://pages.prodigy.net/drew/pycover
SunOS 5.5.1 Last change: 2