summaryrefslogtreecommitdiff
path: root/python/subunit/test_results.py
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2013-02-27 23:30:53 +1300
committerRobert Collins <robertc@robertcollins.net>2013-02-27 23:30:53 +1300
commit1565f398b5520f45be1852c3d8a8ffdcf8dccfe2 (patch)
tree7bebcfcf2ea60cfa17d5b7cb5b00bf77e018e1f5 /python/subunit/test_results.py
parent82824540ee2711e5abb4f1dcd8fb928ec12ae2b0 (diff)
downloadsubunit-git-1565f398b5520f45be1852c3d8a8ffdcf8dccfe2.tar.gz
Update subunit-ls.
Diffstat (limited to 'python/subunit/test_results.py')
-rw-r--r--python/subunit/test_results.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/python/subunit/test_results.py b/python/subunit/test_results.py
index 91c9bbd..7d60962 100644
--- a/python/subunit/test_results.py
+++ b/python/subunit/test_results.py
@@ -25,8 +25,10 @@ from testtools.content import (
text_content,
TracebackContent,
)
+from testtools import StreamResult
from subunit import iso8601
+import subunit
# NOT a TestResult, because we are implementing the interface, not inheriting
@@ -676,3 +678,16 @@ class CsvResult(TestByTestResult):
def startTestRun(self):
super(CsvResult, self).startTestRun()
self._write_row(['test', 'status', 'start_time', 'stop_time'])
+
+
+class CatFiles(StreamResult):
+ """Cat file attachments received to a stream."""
+
+ def __init__(self, byte_stream):
+ self.stream = subunit.make_stream_binary(byte_stream)
+
+ def status(self, test_id=None, test_status=None, test_tags=None,
+ runnable=True, file_name=None, file_bytes=None, eof=False,
+ mime_type=None, route_code=None, timestamp=None):
+ if file_name is not None:
+ self.stream.write(file_bytes)