How to get branch coverage

================================================

- setup dstanekcom-python-nose clone

http://code.google.com/r/dstanekcom-python-nose/

How to get branch coverage

================================================

1. Get nose path

$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import nose
>>> nose
<module 'nose' from '/usr/lib/pymodules/python2.6/nose/__init__.pyc'>

2. Swich nose

$ cd /usr/lib/pymodules/python2.6
$ hg clone https://dstanekcom-python-nose.googlecode.com/hg/ dstanekcom-python-nose
$ mv /usr/lib/pymodules/python2.6/nose /usr/lib/pymodules/python2.6/nose_orig
$ sudo ln -s dstanekcom-python-nose/nose nose

http://www.traceback.org/2009/11/13/getting-branch-coverage-in-nose/

3. update coverage

$ sudo easy_install coverage

Version check ( We need Coverage.py, version 3.4.)

$ coverage --version
Coverage.py, version 3.4.  

http://nedbatchelder.com/code/coverage

4. run test

move to your nova directory

$ ./run_tests.sh -N -s --with-coverage --cover-package=nova --cover-html --cover-branch --cover-html-dir=./coverage

You can download sample result.branch.tar.gz

Wiki: branch_coverage (last edited 2011-05-27 03:51:32 by NachiUeno)