summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorThomi Richards <thomi.richards@canonical.com>2013-11-25 11:46:12 +1300
committerThomi Richards <thomi.richards@canonical.com>2013-11-25 11:46:12 +1300
commit4d3beb5ed8f0601770b7c9eaf0bd64ce9b917547 (patch)
tree88f1f24087768054b3954c0cbec9694f5eb82671 /python
parent0eb7dbe09fb06f4f14e4a3ff766a776126a0c200 (diff)
downloadsubunit-4d3beb5ed8f0601770b7c9eaf0bd64ce9b917547.tar.gz
Python version compatibility fixes.
Diffstat (limited to 'python')
-rw-r--r--python/subunit/tests/test_output_filter.py8
1 files changed, 6 insertions, 2 deletions
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):