diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-09-24 07:50:25 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-09-24 07:50:25 -0400 |
commit | 252cf9315ee1cdabab7b35bf8e868e7ac73b0429 (patch) | |
tree | 69fb14ce3567e8448fca312969de0480fde762c8 | |
parent | 321e1921ca02a3dc3507eb095efd38efe6c79ba9 (diff) | |
download | python-coveragepy-git-252cf9315ee1cdabab7b35bf8e868e7ac73b0429.tar.gz |
Don't print a call stack for each line in multi-line debug output
-rw-r--r-- | CHANGES.rst | 4 | ||||
-rw-r--r-- | coverage/debug.py | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 82bb217a..e67e820c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -30,6 +30,10 @@ Unreleased - Support PyPy3 5.2 alpha 1. +- If you used the debug options "config" and "callers" together, you'd get a + call stack printed for every line in the multi-line config output. This is + now fixed. + .. _issue 412: https://bitbucket.org/ned/coveragepy/issues/412/coverage-combine-should-error-if-no .. _issue 505: https://bitbucket.org/ned/coveragepy/issues/505/use-canonical-filename-for-debounce .. _issue 510: https://bitbucket.org/ned/coveragepy/issues/510/erase-still-needed-in-42 diff --git a/coverage/debug.py b/coverage/debug.py index 96e57920..823d2b22 100644 --- a/coverage/debug.py +++ b/coverage/debug.py @@ -37,8 +37,14 @@ class DebugControl(object): """Decide whether to output debug information in category `option`.""" return (option in self.options or option in FORCED_DEBUG) - def write(self, msg): - """Write a line of debug output.""" + def write(self, msg, callers=True): + """Write a line of debug output. + + `msg` is the line to write. A newline will be appended. If `callers` + is true, and the user has requested it, the call stack will be written + also. + + """ if self.should('pid'): msg = "pid %5d: %s" % (os.getpid(), msg) self.output.write(msg+"\n") @@ -50,7 +56,7 @@ class DebugControl(object): """Write a sequence of (label,data) pairs nicely.""" self.write(info_header(header)) for line in info_formatter(info): - self.write(" %s" % line) + self.write(" %s" % line, callers=False) def info_header(label): |