diff options
| author | Ned Batchelder <ned@nedbatchelder.com> | 2015-01-17 14:55:14 -0500 |
|---|---|---|
| committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-01-17 14:55:14 -0500 |
| commit | e5d90dcdabb5e9d59f6957ce92b72e36b27c3265 (patch) | |
| tree | c53ac3eaf8dca2c4e808fc4fcecd07c02c07788e /coverage | |
| parent | 880a71c0c26a0c22294af1859699db78711d65c0 (diff) | |
| download | python-coveragepy-e5d90dcdabb5e9d59f6957ce92b72e36b27c3265.tar.gz | |
Use file names with extensions in reports.
Diffstat (limited to 'coverage')
| -rw-r--r-- | coverage/annotate.py | 4 | ||||
| -rw-r--r-- | coverage/codeunit.py | 14 |
2 files changed, 8 insertions, 10 deletions
diff --git a/coverage/annotate.py b/coverage/annotate.py index 5b96448..3487feb 100644 --- a/coverage/annotate.py +++ b/coverage/annotate.py @@ -53,7 +53,9 @@ class AnnotateReporter(Reporter): if self.directory: dest_file = os.path.join(self.directory, cu.flat_rootname()) - dest_file += ".py,cover" + if dest_file.endswith("_py"): + dest_file = dest_file[:-3] + ".py" + dest_file += ",cover" else: dest_file = cu.filename + ",cover" diff --git a/coverage/codeunit.py b/coverage/codeunit.py index 2815526..e75018d 100644 --- a/coverage/codeunit.py +++ b/coverage/codeunit.py @@ -28,19 +28,18 @@ class CodeUnit(FileReporter): self.filename = self.file_locator.canonical_filename(f) if hasattr(morf, '__name__'): - n = modname = morf.__name__ + n = morf.__name__ + n = n.replace(".", os.sep) + ".py" self.relative = True else: - n = os.path.splitext(morf)[0] + n = f #os.path.splitext(f)[0] rel = self.file_locator.relative_filename(n) if os.path.isabs(n): self.relative = (rel != n) else: self.relative = True n = rel - modname = None self.name = n - self.modname = modname def _adjust_filename(self, f): # TODO: This shouldn't be in the base class, right? @@ -56,8 +55,5 @@ class CodeUnit(FileReporter): For example, the file a/b/c.py will return 'a_b_c' """ - if self.modname: - return self.modname.replace('.', '_') - else: - root = os.path.splitdrive(self.name)[1] - return root.replace('\\', '_').replace('/', '_').replace('.', '_') + root = os.path.splitdrive(self.name)[1] + return root.replace('\\', '_').replace('/', '_').replace('.', '_') |
