summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-03-20 09:43:29 -0400
committerNed Batchelder <ned@nedbatchelder.com>2012-03-20 09:43:29 -0400
commit2017d360f977e953030c558ab57295741e2160bd (patch)
tree2d18c15bed5362d19a4e7b8d0e9fd2b9b9b87254 /coverage/control.py
parent53357077986f061b6a1fbe2a15cde14c4da6dae8 (diff)
downloadpython-coveragepy-2017d360f977e953030c558ab57295741e2160bd.tar.gz
All the tests pass under PyPy: sys has a bogus __file__, Unicode is 4-byte, and pypy inserts an extra stack frame into tracebacks.
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/coverage/control.py b/coverage/control.py
index b617f48..ddeb77c 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -327,7 +327,7 @@ class coverage(object):
try:
pkg_file = mod.__file__
except AttributeError:
- self._warn("Module %s has no Python source." % pkg)
+ pkg_file = None
else:
d, f = os.path.split(pkg_file)
if f.startswith('__init__.'):
@@ -336,8 +336,14 @@ class coverage(object):
else:
pkg_file = self._source_for_file(pkg_file)
pkg_file = self.file_locator.canonical_filename(pkg_file)
+ if not os.path.exists(pkg_file):
+ pkg_file = None
+
+ if pkg_file:
self.source.append(pkg_file)
self.source_match.add(pkg_file)
+ else:
+ self._warn("Module %s has no Python source." % pkg)
for pkg in found:
self.source_pkgs.remove(pkg)