From 2bdad357fa19f05a3a579b47578f1510974eb0a4 Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Fri, 24 May 2013 10:35:28 -0500 Subject: python3: python3 binary/text data compatbility Python3 enforces the distinction between byte strings far more rigorously than Python 2 does; binary data cannot be automatically coerced to or from text data. Use six to provide a fake file object for textual data. It provides an alias for StringIO.StringIO in python2 and io.StringIO in python3 Change-Id: I65897bb0cca2cbeb5819a769b98645c9eb066401 Signed-off-by: Chuck Short --- tests/unit/test_processutils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests/unit/test_processutils.py') diff --git a/tests/unit/test_processutils.py b/tests/unit/test_processutils.py index e00a66e..fbe9f34 100644 --- a/tests/unit/test_processutils.py +++ b/tests/unit/test_processutils.py @@ -19,9 +19,10 @@ from __future__ import print_function import fixtures import os -import StringIO import tempfile +from six import StringIO + from openstack.common import processutils from tests import utils @@ -213,7 +214,7 @@ class FakeSshChannel(object): return self.rc -class FakeSshStream(StringIO.StringIO): +class FakeSshStream(StringIO): def setup_channel(self, rc): self.channel = FakeSshChannel(rc) @@ -225,9 +226,9 @@ class FakeSshConnection(object): def exec_command(self, cmd): stdout = FakeSshStream('stdout') stdout.setup_channel(self.rc) - return (StringIO.StringIO(), + return (StringIO(), stdout, - StringIO.StringIO('stderr')) + StringIO('stderr')) class SshExecuteTestCase(utils.BaseTestCase): -- cgit