summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJonathan Lange <jml@mumak.net>2012-03-25 15:48:46 +0100
committerJonathan Lange <jml@mumak.net>2012-03-25 15:48:46 +0100
commit6b8fb41b69b58bdbe639e324e45803ecdb169726 (patch)
tree8c9f54954bdba18dc1d69c3c27c9c9823f4f27ee /python
parent8d917cbb485352c5834c1716787538888223aafc (diff)
downloadsubunit-git-6b8fb41b69b58bdbe639e324e45803ecdb169726.tar.gz
Test for csv output.
Diffstat (limited to 'python')
-rw-r--r--python/subunit/tests/test_test_results.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/python/subunit/tests/test_test_results.py b/python/subunit/tests/test_test_results.py
index 36ef15d..f3f3480 100644
--- a/python/subunit/tests/test_test_results.py
+++ b/python/subunit/tests/test_test_results.py
@@ -14,11 +14,13 @@
# limitations under that license.
#
+import csv
import datetime
import sys
import unittest
from testtools import TestCase
+from testtools.compat import StringIO
from testtools.content import (
text_content,
TracebackContent,
@@ -452,7 +454,26 @@ class TestByTestResultTests(testtools.TestCase):
],
self.log)
-# XXX: Tests for csv_result
+
+class TestCsvResult(testtools.TestCase):
+
+ def test_csv_output(self):
+ stream = StringIO()
+ result = subunit.test_results.csv_result(stream)
+ result._now = iter(range(5)).next
+ result.startTestRun()
+ result.startTest(self)
+ result.addSuccess(self)
+ result.stopTest(self)
+ result.stopTestRun()
+ stream.seek(0)
+ reader = csv.reader(stream)
+ output = list(reader)
+ self.assertEqual(
+ [['test', 'status', 'start_time', 'stop_time'],
+ [self.id(), 'success', '0', '1'],
+ ],
+ output)
# XXX: Tests for subunit2csv