summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoff Bache <none@none>2010-12-10 21:34:14 +0100
committerGeoff Bache <none@none>2010-12-10 21:34:14 +0100
commit8216f6839fe4f07b5e05f55ffcb34b8d8c684c93 (patch)
treed805636ae7d71616e4fbf7ddb6dcf5038ab8f298
parent661145c137e4159859663e047d4890b132203a42 (diff)
downloadpython-coveragepy-git-8216f6839fe4f07b5e05f55ffcb34b8d8c684c93.tar.gz
Handle compiled files under Jython
-rw-r--r--coverage/codeunit.py2
-rw-r--r--coverage/control.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/coverage/codeunit.py b/coverage/codeunit.py
index dfc4560d..ac90cb21 100644
--- a/coverage/codeunit.py
+++ b/coverage/codeunit.py
@@ -54,6 +54,8 @@ class CodeUnit(object):
# .pyc files should always refer to a .py instead.
if f.endswith('.pyc'):
f = f[:-1]
+ elif f.endswith('$py.class'): # jython
+ f = f[:-9] + ".py"
self.filename = self.file_locator.canonical_filename(f)
if hasattr(morf, '__name__'):
diff --git a/coverage/control.py b/coverage/control.py
index 4fae198c..54e6d3f9 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -193,6 +193,8 @@ class coverage(object):
if not filename.endswith(".py"):
if filename[-4:-1] == ".py":
filename = filename[:-1]
+ elif filename.endswith("$py.class"): # jython
+ filename = filename[:-9] + ".py"
return filename
def _should_trace(self, filename, frame):
@@ -307,7 +309,7 @@ class coverage(object):
self._warn("Module %s has no python source." % pkg)
else:
d, f = os.path.split(pkg_file)
- if f.startswith('__init__.'):
+ if f.startswith('__init__'):
# This is actually a package, return the directory.
pkg_file = d
else: