![]() | Ned Batchelder : Blog | Code | Text | Site coverage.py » Home : Code |
Created 24 May 2009, last updated 6 March 2010 Coverage.py is a tool for measuring code coverage of Python programs. It monitors your program, noting which parts of the code have been executed, then analyzes the source to identify code that could have been executed but was not. Coverage measurement is typically used to gauge the effectiveness of tests. It can show which parts of your product code are being exercised by tests, and which are not. The latest version is 3.3.1, released 6 March 2010. It is supported on Python 2.3 through 3.1. Quick startGetting started is easy:
Using coverage.pyThere are a few different ways to use coverage.py. The simplest is the command line, which lets you run your program and see the results. If you need more control over how your project is measured, you can use the API. Some test runners provide coverage integration to make it easy to use coverage while running tests. For example, nose has a cover plug-in. You can fine-tune coverage’s view of your code by directing it to ignore parts that you know aren’t interesting. See Excluding Code for details. HistoryCoverage.py was originally written by Gareth Rees. Since 2004, Ned Batchelder has extended and maintained it with the help of many others. More information
Next: Coverage command line usage » | |