In order to perform coverage analysis, pry must know a few things about the structure of your project. The following parameters can be set in the .pry configuration file, which can be placed in any directory containing tests:
coverage: the path to the base of the module under test.
exclude: a list of paths that should be excluded from from coverage analysis.
base: the base of the project. This path is added to sys.path so that project imports function correctly.
-- project
|-- module
| |-- __init__.py
| |-- exclude.py
| |-- one.py
| `-- two.py
`-- test
|-- .pry
|-- test_one.py
`-- test_two.py
module is the module under test, and exclude.py is a source file that should be excluded from coverage analysis. The pry unit test suite lives in a parallel test directory. The .pry file in the test directory looks like this:
base = .. coverage = ../module exclude = ../module/exclude.py
The .pry syntax is very simple, and is very similar to that of the standard Python ConfigParser module:
# .pry files can contain comments
# Multiple paths can be specified using newlines:
exclude = ../module/exclude.py
../module/exclude2.py
../module/exclude3.py
Copyright Nullcube 2008