summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2008-12-08 12:59:41 +1100
committerRobert Collins <robertc@robertcollins.net>2008-12-08 12:59:41 +1100
commit2c1f561d6466270f2d0f5d9064c3f3a16ea3110c (patch)
tree6cf2e470b682226ce0f822a8018f1aec2a06309b
parent18c5bd4f9736990c5e4c7173a1c39a49faa3f99d (diff)
downloadsubunit-git-2c1f561d6466270f2d0f5d9064c3f3a16ea3110c.tar.gz
Swallow time: commands when seen.
-rw-r--r--README3
-rw-r--r--python/subunit/__init__.py5
-rw-r--r--python/subunit/tests/test_test_protocol.py15
3 files changed, 22 insertions, 1 deletions
diff --git a/README b/README
index e7e8879..65aabe9 100644
--- a/README
+++ b/README
@@ -181,10 +181,13 @@ xfail[:] test label
xfail[:] test label [
]
tags: [-]TAG ...
+time: YYYY-MM-DD HH:MM:SSZ
unexpected output on stdout -> stdout.
exit w/0 or last test -> error
tags given outside a test are applied to all following tests
tags given within a test inherit the current global tags
+The time tag acts as a clock event - it sets the time for all future events.
+Currently this is not exposed at the python API layer.
In python, tags are assigned to the .tags attribute on the RemoteTest objects
created by the TestProtocolServer.
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):