I am gathering the code coverage for my django app and looks like coverage.py
doesn't collect the statistics if the module was imported relatively.
More detailed:
the directory structure looks like this:
project
__init__.py
apps
__init__.py
my_app
__init__.py
my_module.py
tests.py
So if I do from .my_module import *
in tests.py
- then coverage.py
won't gather the statistics for my_module.py
. However, if I put from apps.my_app.my_module import *
, the statistics is there.
I am using django-nose with coverage
plugin and have --cover-package=apps.my_app
flag while running tests.
Has anybody stumbled upon such? I don't really want to always have the full import path, unless I really have to, so any thoughts are appreciated.