From e18b789e06497194a37c86d7dcb8ad094368f4ac Mon Sep 17 00:00:00 2001 From: Buck Golemon Date: Fri, 14 Nov 2014 17:19:00 -0800 Subject: pypy3 sets sys.__file__ to a nonexistant file --- coverage/control.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'coverage/control.py') diff --git a/coverage/control.py b/coverage/control.py index 7a85103..1b932da 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('''\ -- cgit v1.2.1