Browse Source

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
tags/0.1.1
Petr Blaho 5 years ago
parent
commit
2da242b5e6

+ 2
- 2
tuskarclient/tests/common/test_formatting.py View File

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

+ 2
- 2
tuskarclient/tests/v1/test_overcloud_roles_shell.py View File

@@ -10,8 +10,8 @@
10 10
 # License for the specific language governing permissions and limitations
11 11
 # under the License.
12 12
 
13
-import io
14 13
 import mock
14
+import six
15 15
 
16 16
 import tuskarclient.tests.utils as tutils
17 17
 from tuskarclient.v1 import overcloud_roles_shell
@@ -36,7 +36,7 @@ class RacksShellTest(tutils.TestCase):
36 36
 
37 37
     def setUp(self):
38 38
 
39
-        self.outfile = io.StringIO()
39
+        self.outfile = six.StringIO()
40 40
         self.tuskar = mock.MagicMock()
41 41
         self.shell = overcloud_roles_shell
42 42
         super(RacksShellTest, self).setUp()

+ 2
- 2
tuskarclient/tests/v1/test_overclouds_shell.py View File

@@ -10,8 +10,8 @@
10 10
 # License for the specific language governing permissions and limitations
11 11
 # under the License.
12 12
 
13
-import io
14 13
 import mock
14
+import six
15 15
 
16 16
 import tuskarclient.tests.utils as tutils
17 17
 from tuskarclient.v1 import overclouds_shell
@@ -36,7 +36,7 @@ class RacksShellTest(tutils.TestCase):
36 36
 
37 37
     def setUp(self):
38 38
 
39
-        self.outfile = io.StringIO()
39
+        self.outfile = six.StringIO()
40 40
         self.tuskar = mock.MagicMock()
41 41
         self.shell = overclouds_shell
42 42
         super(RacksShellTest, self).setUp()

Loading…
Cancel
Save