summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-05-07 21:19:40 -0400
committerNed Batchelder <ned@nedbatchelder.com>2009-05-07 21:19:40 -0400
commit6bac20d0a7a8815a7d1cf789642ba2342ae212ac (patch)
treef8955edd8a1c5b002fb9fa224b78383e4afd6366 /coverage/control.py
parent2ff24977fbe550ad1494fd25f16ccf95ff36fff8 (diff)
downloadpython-coveragepy-git-6bac20d0a7a8815a7d1cf789642ba2342ae212ac.tar.gz
Treat files not ending in .py properly.
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 3c6b55a0..697e732b 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -40,7 +40,6 @@ class coverage:
should not.
"""
- ofilename = filename
if filename == '<string>':
# There's no point in ever tracing string executions, we can't do
# anything with the data later anyway.
@@ -55,13 +54,12 @@ class coverage:
dunder_file = frame.f_globals.get('__file__')
if dunder_file:
if not dunder_file.endswith(".py"):
- dunder_file = dunder_file[:-1]
+ if dunder_file[-4:-1] == ".py":
+ dunder_file = dunder_file[:-1]
filename = dunder_file
canonical = self.file_locator.canonical_filename(filename)
- #print "of: %r\nfn: %r\n__: %r\nca: %r\n" % (ofilename, filename, dunder_file, canonical)
-
# If we aren't supposed to trace the stdlib, then check if this is in
# the stdlib and skip it if so.
if not self.cover_stdlib: