diff options
| author | Jonathan Lange <jml@canonical.com> | 2012-02-16 09:35:51 +0000 |
|---|---|---|
| committer | Jonathan Lange <jml@canonical.com> | 2012-02-16 09:35:51 +0000 |
| commit | 0882a75f5e3e9adacfece2345afac8570eb7ebd9 (patch) | |
| tree | d37a741d403619fe86e58b420abde0793bb6de18 /python/subunit/__init__.py | |
| parent | f1f773607b070d0b91946ff638931ca8c8bd682d (diff) | |
| parent | 7e1253a627b0d89825d11ac2fa9bdb48e5570a69 (diff) | |
| download | subunit-git-0882a75f5e3e9adacfece2345afac8570eb7ebd9.tar.gz | |
Merge trunk
Diffstat (limited to 'python/subunit/__init__.py')
| -rw-r--r-- | python/subunit/__init__.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index 2b494de..93092b1 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -755,6 +755,15 @@ class TestProtocolClient(testresult.TestResult): self._stream.write(self._progress_fmt + prefix + offset + self._bytes_eol) + def tags(self, new_tags, gone_tags): + """Inform the client about tags added/removed from the stream.""" + if not new_tags and not gone_tags: + return + tags = set([tag.encode('utf8') for tag in new_tags]) + tags.update([_b("-") + tag.encode('utf8') for tag in gone_tags]) + tag_line = _b("tags: ") + _b(" ").join(tags) + _b("\n") + self._stream.write(tag_line) + def time(self, a_datetime): """Inform the client of the time. @@ -1122,7 +1131,7 @@ class ProtocolTestCase(object): :seealso: TestProtocolServer (the subunit wire protocol parser). """ - def __init__(self, stream, passthrough=None, forward=False): + def __init__(self, stream, passthrough=None, forward=None): """Create a ProtocolTestCase reading from stream. :param stream: A filelike object which a subunit stream can be read @@ -1135,6 +1144,8 @@ class ProtocolTestCase(object): self._stream = stream _make_stream_binary(stream) self._passthrough = passthrough + if forward is not None: + _make_stream_binary(forward) self._forward = forward def __call__(self, result=None): |
