summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 7a85103b..1b932da3 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -661,7 +661,10 @@ class Coverage(object):
for pkg in self.not_imported:
if pkg not in sys.modules:
self._warn("Module %s was never imported." % pkg)
- elif not hasattr(sys.modules[pkg], '__file__'):
+ elif not (
+ hasattr(sys.modules[pkg], '__file__') and
+ os.path.exists(sys.modules[pkg].__file__)
+ ):
self._warn("Module %s has no Python source." % pkg)
else:
raise AssertionError('''\