pythoncoverage.pypython-coverage

Changing the default version of python for Ned Batchelder's coverage tool


The title pretty much says it. I'm having problems connected to the change in the unittest python from python 2.5 to 2.7. When I run my test script with python

python _tester.py

it works fine. But when I try to use the coverage tool

coverage erase; coverage run _tester.py; coverage html -d html_cov_report

it crashes saying that assertRaisesRegexp is not an attribute of my subclass of TestCase. I discovered that this was because the coverage tool was using python 2.5 and unittest.TestCase.assertRaisesRegexp does not exist in 2.5.

Anyway, can somebody tell me how to change the python used by coverage?

EDIT: The egg for coverage is in /Library/Python/2.5/site-packages. Does that matter?


Solution

  • The coverage script should have a shebang that can be changed to the right version of python.

    Edit: If you installed it in python 2.5, it is probably easiest to switch to installing using python 2.7.