Only produce a dotted module name when writing output to a separate

directory.
This commit is contained in:
Jeremy Hylton 2003-04-22 15:35:51 +00:00
parent 282be3ab89
commit c8c8b94c59

View file

@ -163,7 +163,7 @@ def modname(path):
return filename return filename
def fullmodname(path): 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 # 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 # 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... # skip some "files" we don't care about...
if filename == "<string>": if filename == "<string>":
continue continue
modulename = fullmodname(filename)
if filename.endswith(".pyc") or filename.endswith(".pyo"): if filename.endswith(".pyc") or filename.endswith(".pyo"):
filename = filename[:-1] filename = filename[:-1]
if coverdir is None: if coverdir is None:
dir = os.path.dirname(os.path.abspath(filename)) dir = os.path.dirname(os.path.abspath(filename))
modulename = modname(filename)
else: else:
dir = coverdir dir = coverdir
if not os.path.exists(dir): if not os.path.exists(dir):
os.makedirs(dir) os.makedirs(dir)
modulename = fullmodname(filename)
# If desired, get a list of the line numbers which represent # If desired, get a list of the line numbers which represent
# executable content (returned as a dict for better lookup speed) # executable content (returned as a dict for better lookup speed)