Use six.StringIO/BytesIO instead of StringIO.StringIO

to keep Python 3.x compatibility, use six.StringIO/BytesIO to
replace StringIO.StringIO

StringIO works for unicode
BytesIO works for bytes

Change-Id: Iba4087cb7a3dd6d1b24744cda0bfa5f45c94f386
Closes-Bug: #1280100
This commit is contained in:
Petr Blaho 2014-02-18 11:34:18 +01:00
parent 2b999ec838
commit 2da242b5e6
3 changed files with 6 additions and 6 deletions

View File

@ -10,8 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import io
import mock
import six
import tuskarclient.common.formatting as fmt
import tuskarclient.tests.utils as tutils
@ -21,7 +21,7 @@ class PrintTest(tutils.TestCase):
def setUp(self):
super(PrintTest, self).setUp()
self.outfile = io.StringIO()
self.outfile = six.StringIO()
def test_print_dict(self):
dict_ = {'k': 'v', 'key': 'value'}

View File

@ -10,8 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import io
import mock
import six
import tuskarclient.tests.utils as tutils
from tuskarclient.v1 import overcloud_roles_shell
@ -36,7 +36,7 @@ class RacksShellTest(tutils.TestCase):
def setUp(self):
self.outfile = io.StringIO()
self.outfile = six.StringIO()
self.tuskar = mock.MagicMock()
self.shell = overcloud_roles_shell
super(RacksShellTest, self).setUp()

View File

@ -10,8 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import io
import mock
import six
import tuskarclient.tests.utils as tutils
from tuskarclient.v1 import overclouds_shell
@ -36,7 +36,7 @@ class RacksShellTest(tutils.TestCase):
def setUp(self):
self.outfile = io.StringIO()
self.outfile = six.StringIO()
self.tuskar = mock.MagicMock()
self.shell = overclouds_shell
super(RacksShellTest, self).setUp()