From ae3deed9e39b528abc2259a2fe7f7178623fce8e 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 --HG-- branch : __main__-support --- 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 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('''\ -- cgit v1.2.1