From d0ee1989ec56dc039ad880c1d554e66dd4caddd8 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 20 Mar 2012 09:43:29 -0400 Subject: All the tests pass under PyPy: sys has a bogus __file__, Unicode is 4-byte, and pypy inserts an extra stack frame into tracebacks. --- coverage/control.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'coverage/control.py') diff --git a/coverage/control.py b/coverage/control.py index b617f486..ddeb77c0 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) -- cgit v1.2.1