summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorloic <loic@dachary.org>2017-01-10 22:44:51 +0100
committerloic <loic@dachary.org>2017-01-10 22:44:51 +0100
commitd9ca8593eba371b49402974c1c1f2bf7fd52fed9 (patch)
treed86df71710408341d8054eea2c0533942729dc2b
parent484d5cea59b7f5f0891fd62dc8565b74e92e75ac (diff)
downloadpython-coveragepy-issue-426.tar.gz
comment explaining the rationale of --source pkgissue-426
-rw-r--r--coverage/control.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 7969432..243fe58 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -811,6 +811,12 @@ class Coverage(object):
not os.path.exists(sys.modules[pkg].__file__)):
continue
pkg_file = source_for_file(sys.modules[pkg].__file__)
+ #
+ # Do not explore the souce tree of a module that is
+ # not a directory tree. For instance if
+ # sys.modules['args'].__file__ == /lib/python2.7/site-packages/args.pyc
+ # we do not want to explore all of /lib/python2.7/site-packages
+ #
if not pkg_file.endswith('__init__.py'):
continue
src_directories.append(self._canonical_dir(sys.modules[pkg]))