summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-02-08 10:08:56 -0500
committerNed Batchelder <ned@nedbatchelder.com>2015-02-08 10:08:56 -0500
commita2331114926f37823f0dc45dc44308a94c0d454e (patch)
tree1ab66e1213b63fd45260328d1208eb690919edc9
parent7d95e303613cfbbc9067f4813c641c61aa251dc8 (diff)
downloadpython-coveragepy-git-a2331114926f37823f0dc45dc44308a94c0d454e.tar.gz
Useful debugging help.
-rw-r--r--coverage/control.py10
-rw-r--r--coverage/debug.py5
-rw-r--r--coverage/test_helpers.py5
3 files changed, 20 insertions, 0 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 1a6d4e71..7398ced0 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -1027,6 +1027,16 @@ class FileDisposition(object):
self.file_tracer = None
self.has_dynamic_filename = False
+ def __repr__(self):
+ ret = "FileDisposition %r" % (self.original_filename,)
+ if self.trace:
+ ret += " trace"
+ else:
+ ret += " notrace=%r" % (self.reason,)
+ if self.file_tracer:
+ ret += " file_tracer=%r" % (self.file_tracer,)
+ return "<" + ret + ">"
+
def debug_message(self):
"""Produce a debugging message explaining the outcome."""
if self.trace:
diff --git a/coverage/debug.py b/coverage/debug.py
index 74315231..5b41bc40 100644
--- a/coverage/debug.py
+++ b/coverage/debug.py
@@ -17,6 +17,11 @@ class DebugControl(object):
self.options = options
self.output = output
+ def __repr__(self):
+ return "<DebugControl options=%r output=%r>" % (
+ self.options, self.output
+ )
+
def should(self, option):
"""Decide whether to output debug information in category `option`."""
return (option in self.options or option in FORCED_DEBUG)
diff --git a/coverage/test_helpers.py b/coverage/test_helpers.py
index a4c73d31..a42fe3b4 100644
--- a/coverage/test_helpers.py
+++ b/coverage/test_helpers.py
@@ -27,6 +27,11 @@ class Tee(object):
for f in self._files:
f.write(data)
+ def flush(self):
+ """Flush the data on all the files."""
+ for f in self._files:
+ f.flush()
+
if 0:
# Use this if you need to use a debugger, though it makes some tests
# fail, I'm not sure why...