diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-01-24 10:28:44 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-01-24 10:28:44 -0500 |
commit | 4ddf53a6d962a001782a0838b1b8748041125be4 (patch) | |
tree | fff894b694537d9ada8e0d2a12c24847c28b8cd3 /coverage/debug.py | |
parent | c1bfa7352368b63f3a9b30c02f242408d07a7ab2 (diff) | |
download | python-coveragepy-git-4ddf53a6d962a001782a0838b1b8748041125be4.tar.gz |
Make the two forms of debug output more uniform
Diffstat (limited to 'coverage/debug.py')
-rw-r--r-- | coverage/debug.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/coverage/debug.py b/coverage/debug.py index c441dffd..74315231 100644 --- a/coverage/debug.py +++ b/coverage/debug.py @@ -28,12 +28,18 @@ class DebugControl(object): self.output.write(msg+"\n") self.output.flush() - def write_formatted_info(self, info): + def write_formatted_info(self, header, info): """Write a sequence of (label,data) pairs nicely.""" + self.write(info_header(header)) for line in info_formatter(info): self.write(" %s" % line) +def info_header(label): + """Make a nice header string.""" + return "--{0:-<60s}".format(" "+label+" ") + + def info_formatter(info): """Produce a sequence of formatted lines from info. @@ -42,6 +48,8 @@ def info_formatter(info): """ info = list(info) + if not info: + return label_len = max(len(l) for l, _d in info) for label, data in info: if data == []: |