summaryrefslogtreecommitdiff
path: root/python
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
parent82824540ee2711e5abb4f1dcd8fb928ec12ae2b0 (diff)
downloadsubunit-git-1565f398b5520f45be1852c3d8a8ffdcf8dccfe2.tar.gz
Update subunit-ls.
Diffstat (limited to 'python')
-rw-r--r--python/subunit/filters.py2
-rw-r--r--python/subunit/test_results.py15
2 files changed, 16 insertions, 1 deletions
diff --git a/python/subunit/filters.py b/python/subunit/filters.py
index 208bd8b..be3b6b8 100644
--- a/python/subunit/filters.py
+++ b/python/subunit/filters.py
@@ -102,7 +102,7 @@ def filter_by_result(result_factory, output_path, passthrough, forward,
:param input_stream: The source of subunit input. Defaults to
``sys.stdin``.
:param protocol_version: The subunit protocol version to expect.
- :return: A test result with the resultts of the run.
+ :return: A test result with the results of the run.
"""
if passthrough:
passthrough_stream = sys.stdout
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)