From dd89c81df541ba7a43303e225b0c7c3fd4ccb756 Mon Sep 17 00:00:00 2001 From: Thomi Richards Date: Mon, 25 Nov 2013 11:46:12 +1300 Subject: Python version compatibility fixes. --- python/subunit/tests/test_output_filter.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'python/subunit') diff --git a/python/subunit/tests/test_output_filter.py b/python/subunit/tests/test_output_filter.py index ba96687..658174c 100644 --- a/python/subunit/tests/test_output_filter.py +++ b/python/subunit/tests/test_output_filter.py @@ -13,10 +13,11 @@ # license you chose for the specific language governing permissions and # limitations under that license. # -import optparse import datetime from functools import partial from io import BytesIO, StringIO +import optparse +import sys from tempfile import NamedTemporaryFile from testscenarios import WithScenarios @@ -127,7 +128,10 @@ class ArgParserTests(TestCase): def setUp(self): super(ArgParserTests, self).setUp() # prevent OptionParser from printing to stderr: - self._stderr = BytesIO() + if sys.version[0] > '2': + self._stderr = StringIO() + else: + self._stderr = BytesIO() self.patch(optparse.sys, 'stderr', self._stderr) def test_can_parse_attach_file_without_test_id(self): -- cgit v1.2.1