diff options
| author | Jonathan Lange <jml@mumak.net> | 2012-03-25 15:48:46 +0100 |
|---|---|---|
| committer | Jonathan Lange <jml@mumak.net> | 2012-03-25 15:48:46 +0100 |
| commit | 6b8fb41b69b58bdbe639e324e45803ecdb169726 (patch) | |
| tree | 8c9f54954bdba18dc1d69c3c27c9c9823f4f27ee /python | |
| parent | 8d917cbb485352c5834c1716787538888223aafc (diff) | |
| download | subunit-git-6b8fb41b69b58bdbe639e324e45803ecdb169726.tar.gz | |
Test for csv output.
Diffstat (limited to 'python')
| -rw-r--r-- | python/subunit/tests/test_test_results.py | 23 |
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 |
