Conflict between PEAK and coverage.py
Bobby Impollonia <[email protected]> Sat, 12 Mar 2011 15:19:34 -0800
| Newsgroups | gmane.comp.python.peak |
|---|---|
| Message-ID | <[email protected]> |
Hi. I am trying to measure code coverage for a project using coverage.py. The project relies on DecoratorTools and PEAK-Rules via Turbogears. With DecoratorTools 1.8, the coverage report always comes back as 0% due to a known problem where DecoratorTools removes coverage's tracing function. This is fixed in the development version of DecoratorTools which uses sys.gettrace() on Python 2.6+ to find and restore existing tracing functions. However, with the current development versions of DecoratorTools and PEAK-Rules, I now receive an error importing PEAK-Rules when (and only when) running under coverage.py. The error is: TypeError: unbound method make_decorator() must be called with Method instance as first argument (got str instance instead) It originates from line 296 of peak.rules.core: when = Method.make_decorator( "when", "Extend a generic function with a new action" ) You can reproduce the problem with the following steps using Python 2.6: virtualenv --no-site-packages myenv cd myenv . bin/activate pip install ez_setup coverage distribute==0.6.14 pip install http://svn.eby-sarna.com/DecoratorTools.tar.gz?view=tar pip install http://svn.eby-sarna.com/PEAK-Rules.tar.gz?view=tar echo '#!/usr/bin/env python' > mytest.py echo 'import peak.rules' >> mytest.py chmod +x mytest.py ./mytest.py # this succeeds coverage run ./mytest.py # this throws the exception