summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2003-04-22 15:35:51 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2003-04-22 15:35:51 (GMT)
commitc8c8b94c59ee0446d81fb67c0cc5474c1dc2250e (patch)
tree43f90b6dd731a3e3cdedec45f3705a23fe606f07
parent282be3ab89ff864c5499b38442a51b696401d0c8 (diff)
downloadcpython-c8c8b94c59ee0446d81fb67c0cc5474c1dc2250e.zip
cpython-c8c8b94c59ee0446d81fb67c0cc5474c1dc2250e.tar.gz
cpython-c8c8b94c59ee0446d81fb67c0cc5474c1dc2250e.tar.bz2
Only produce a dotted module name when writing output to a separate
directory.
-rw-r--r--Lib/trace.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/trace.py b/Lib/trace.py
index 0a063c7..cda7258 100644
--- a/Lib/trace.py
+++ b/Lib/trace.py
@@ -163,7 +163,7 @@ def modname(path):
return filename
def fullmodname(path):
- """Return a plausible module name for the patch."""
+ """Return a plausible module name for the path."""
# If the file 'path' is part of a package, then the filename isn't
# enough to uniquely identify it. Try to do the right thing by
@@ -244,17 +244,18 @@ class CoverageResults:
# skip some "files" we don't care about...
if filename == "<string>":
continue
- modulename = fullmodname(filename)
if filename.endswith(".pyc") or filename.endswith(".pyo"):
filename = filename[:-1]
if coverdir is None:
dir = os.path.dirname(os.path.abspath(filename))
+ modulename = modname(filename)
else:
dir = coverdir
if not os.path.exists(dir):
os.makedirs(dir)
+ modulename = fullmodname(filename)
# If desired, get a list of the line numbers which represent
# executable content (returned as a dict for better lookup speed)