From 0b79941f37f6bd9a56afac0178713d082a0db0fb Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 15 Apr 2009 13:22:51 -0400 Subject: If a module was loaded from a .pyc, report its file as .py --- coverage/codeunit.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'coverage/codeunit.py') diff --git a/coverage/codeunit.py b/coverage/codeunit.py index 221d677..96ed43b 100644 --- a/coverage/codeunit.py +++ b/coverage/codeunit.py @@ -57,6 +57,9 @@ class CodeUnit: f = morf.__file__ else: f = morf + # .pyc files should always refer to a .py instead. + if f.endswith('.pyc'): + f = f[:-1] self.filename = file_locator.canonical_filename(f) if hasattr(morf, '__name__'): -- cgit v1.2.1