From 5c1a9d0cbe7cddead8db74f1681121ef36e56616 Mon Sep 17 00:00:00 2001 From: Martin Packman Date: Wed, 4 Jan 2012 10:25:24 +0000 Subject: Set binary mode on the forwarded stream in ProtocolTestCase as used by filters --- python/subunit/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'python/subunit/__init__.py') diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index b4c9397..e14ebe3 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -1122,7 +1122,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 +1135,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): -- cgit v1.2.1 From 00461beb4b64db6050cc38f70122c475394df057 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Wed, 11 Jan 2012 18:42:53 +1300 Subject: Tag support has been implemented for TestProtocolClient. (Robert Collins, #518016) --- python/subunit/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'python/subunit/__init__.py') diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index b4c9397..b30b8fe 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. -- cgit v1.2.1