File: coverage_testing.rst

package info (click to toggle)
nipy 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,352 kB
  • sloc: python: 39,115; ansic: 30,931; makefile: 210; sh: 93
file content (30 lines) | stat: -rw-r--r-- 1,200 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

Coverage Testing
----------------

Coverage testing is a technique used to see how much of the code is
exercised by the unit tests. It is important to remember that a high
level of coverage is a necessary but not sufficient condition for
having effective tests. Coverage testing can be useful for identifying
whole functions or classes which are not tested, or for finding
certain conditions which are never tested.

This is an excellent task for pytest_ - the automated test runner we are
using.  Pytest can run the `python coverage tester`_.  First make sure
you have the coverage test plugin installed on your system::

    pip install pytest-cov

Run Pytest with coverage testing arguments::

    pytest --cov=nipy --doctest-plus nipy

The coverage report will cover any python source module imported after
the start of the test.  This can be noisy and difficult to focus on
the specific module for which you are writing tests.  For
instance, the default report also includes coverage of most of
``numpy``.  To focus the coverage report, you can provide Pytest with
the specific package you would like output from using the
``--cov=nipy`` (the option above).

.. include:: ../../links_names.txt