diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-18 15:19:16 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-18 15:19:16 -0400 |
commit | b974729cedc7c967be07314fc4a20815575cc618 (patch) | |
tree | a3b9385d6973f217abc022ffdcbe134c4f41b3bc /tests/coveragetest.py | |
parent | 2283cfd510d36068845ad085d78b77e4c01a228a (diff) | |
download | python-coveragepy-git-b974729cedc7c967be07314fc4a20815575cc618.tar.gz |
Add test of the debug output when reading/writing data
Diffstat (limited to 'tests/coveragetest.py')
-rw-r--r-- | tests/coveragetest.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/coveragetest.py b/tests/coveragetest.py index 2f488616..a8535418 100644 --- a/tests/coveragetest.py +++ b/tests/coveragetest.py @@ -12,7 +12,7 @@ import sys import coverage from coverage.backunittest import TestCase from coverage.backward import StringIO, import_local_file, string_class -from coverage.debug import _TEST_NAME_FILE +from coverage.debug import _TEST_NAME_FILE, DebugControl from coverage.test_helpers import ( EnvironmentAwareMixin, StdStreamCapturingMixin, TempDirMixin, ) @@ -373,3 +373,13 @@ class CoverageTest( def last_line_squeezed(self, report): """Return the last line of `report` with the spaces squeezed down.""" return self.squeezed_lines(report)[-1] + + +class DebugControlString(DebugControl): + """A `DebugControl` that writes to a StringIO, for testing.""" + def __init__(self, options): + super(DebugControlString, self).__init__(options, StringIO()) + + def get_output(self): + """Get the output text from the `DebugControl`.""" + return self.output.getvalue() |