


PYCOVER(1)                                             PYCOVER(1)


NAME
       pycover  -  generate  coverage information for python pro-
       grams

       pyviewc - coverage data viewer

SYNOPSYS
       pycover [python program] [python program args]

       pyviewc [-i file] [--input=file]  [-I  re]  [--include=re]
       [-e re] [--exclude=re] [files...]

DESCRIPTION
       These  programs generate and view coverage information for
       python programs.  The pycover program generates the cover-
       age 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 appropri-
       ate 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 file, --input=file
              For  pyviewc,  read  coverage  data  from  the file
              instead of the default location.

       -I re, --include=re
              write coverage results for  files  that  match  the
              regular expression re

       -e re, --exclude=re
              do  not  produce  coverage  results  for files that
              match the regular expression re



                                                                1





PYCOVER(1)                                             PYCOVER(1)


       -h, --help
              print out a help screen


   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).


   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
              o   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 exe-
                  cuted.  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 <drew_csillag@geocities.com>







                                                                2

