20130307¶
Today I started to use Fabric and to replace my Makefiles by a single fabfile.py, the same for all projects. Currently there are four projects I plan to manage with this system: djangosite, north, lino and welfare.
Coverage.py warning: No data was collected.¶
Here is a strange phenomen:
If you import some Python module (here djangosite), then its __file__ attribute contains sometimes a relative path and sometimes an absolute path.
T:hgworksitedjangosite>python -c “import djangosite; print djangosite.__file__” t:hgworksitedjangosite__init__.pyc
T:hgworksitedjangosite>cd ..
T:hgworksite>python -c “import djangosite; print djangosite.__file__” djangosite__init__.pyc
The explanation is here: https://stackoverflow.com/questions/7116889/python-file-attribute-absolute-or-relative
I had the following in my t:hgworksite.coveragerc:
[run]
source = djangosite
The problem is that the source specifies “either a package name or a directory name”. And what happens if both apply? You get a “Coverage.py warning: No data was collected.”
To work around this I specified the absolute path:
[run]
source = t:\hgwork\site\djangosite