Tag support has been implemented for TestProtocolClient.
(Robert Collins, #518016)
This commit is contained in:
3
NEWS
3
NEWS
@@ -22,6 +22,9 @@ BUG FIXES
|
||||
'--no-xfail', '--no-passthrough, '--no-success', and gives you just the
|
||||
failure stream. (John Arbash Meinel)
|
||||
|
||||
* Tag support has been implemented for TestProtocolClient.
|
||||
(Robert Collins, #518016)
|
||||
|
||||
* Test suite works with latest testtools (but not older ones - formatting
|
||||
changes only). (Robert Collins)
|
||||
|
||||
|
@@ -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.
|
||||
|
||||
|
@@ -1299,6 +1299,22 @@ class TestTestProtocolClient(unittest.TestCase):
|
||||
"something\n"
|
||||
"F\r\nserialised\nform0\r\n]\n" % self.test.id()))
|
||||
|
||||
def test_tags_empty(self):
|
||||
self.protocol.tags(set(), set())
|
||||
self.assertEqual(_b(""), self.io.getvalue())
|
||||
|
||||
def test_tags_add(self):
|
||||
self.protocol.tags(set(['foo']), set())
|
||||
self.assertEqual(_b("tags: foo\n"), self.io.getvalue())
|
||||
|
||||
def test_tags_both(self):
|
||||
self.protocol.tags(set(['quux']), set(['bar']))
|
||||
self.assertEqual(_b("tags: quux -bar\n"), self.io.getvalue())
|
||||
|
||||
def test_tags_gone(self):
|
||||
self.protocol.tags(set(), set(['bar']))
|
||||
self.assertEqual(_b("tags: -bar\n"), self.io.getvalue())
|
||||
|
||||
|
||||
def test_suite():
|
||||
loader = subunit.tests.TestUtil.TestLoader()
|
||||
|
Reference in New Issue
Block a user