From 2c1f561d6466270f2d0f5d9064c3f3a16ea3110c Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Mon, 8 Dec 2008 12:59:41 +1100 Subject: Swallow time: commands when seen. --- python/subunit/__init__.py | 5 ++++- python/subunit/tests/test_test_protocol.py | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'python') diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index b207176..84d9428 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -213,8 +213,11 @@ class TestProtocolServer(object): self._addSkip(offset, line) elif cmd in ('success', 'successful'): self._addSuccess(offset, line) - elif cmd in ('tags'): + elif cmd in ('tags',): self._handleTags(offset, line) + elif cmd in ('time',): + # Accept it, but do not do anything with it yet. + pass elif cmd == 'xfail': self._addExpectedFail(offset, line) else: diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py index 9088819..a041aa0 100644 --- a/python/subunit/tests/test_test_protocol.py +++ b/python/subunit/tests/test_test_protocol.py @@ -22,6 +22,7 @@ from StringIO import StringIO import os import subunit import sys +import time try: class MockTestProtocolServerClient(object): @@ -747,6 +748,20 @@ class TestTestProtocolServerStreamTags(unittest.TestCase): self.assertEqual(set(["foo", "bar"]), self.protocol.tags) +class TestTestProtocolServerStreamTime(unittest.TestCase): + """Test managing time information at the protocol level.""" + + def setUp(self): + self.client = MockTestProtocolServerClient() + self.stream = StringIO() + self.protocol = subunit.TestProtocolServer(self.client, + stream=self.stream) + + def test_time_accepted(self): + self.protocol.lineReceived("time: 2001-12-12 12:59:59Z\n") + self.assertEqual("", self.stream.getvalue()) + + class TestRemotedTestCase(unittest.TestCase): def test_simple(self): -- cgit v1.2.1