Browse Source

Merge "Use six StringIO"

Zuul 1 year ago
parent
commit
10f28e8491

+ 2
- 3
heat-config-kubelet/install.d/hook-kubelet.py View File

@@ -12,7 +12,6 @@
12 12
 #    License for the specific language governing permissions and limitations
13 13
 #    under the License.
14 14
 
15
-import io
16 15
 import json
17 16
 import logging
18 17
 import os
@@ -82,13 +81,13 @@ def configure_logging():
82 81
     handler.setFormatter(formatter)
83 82
     log.addHandler(handler)
84 83
 
85
-    deploy_stdout = io.StringIO()
84
+    deploy_stdout = six.StringIO()
86 85
     handler = logging.StreamHandler(deploy_stdout)
87 86
     handler.setFormatter(formatter)
88 87
     handler.setLevel('DEBUG')
89 88
     log.addHandler(handler)
90 89
 
91
-    deploy_stderr = io.StringIO()
90
+    deploy_stderr = six.StringIO()
92 91
     handler = logging.StreamHandler(deploy_stderr)
93 92
     handler.setFormatter(formatter)
94 93
     handler.setLevel('WARN')

+ 1
- 5
tests/test_heat_config_notify.py View File

@@ -11,7 +11,6 @@
11 11
 #    License for the specific language governing permissions and limitations
12 12
 #    under the License.
13 13
 
14
-import io
15 14
 import json
16 15
 import tempfile
17 16
 
@@ -77,10 +76,7 @@ class HeatConfigNotifyTest(common.RunScriptTest):
77 76
         super(HeatConfigNotifyTest, self).setUp()
78 77
         self.deployed_dir = self.useFixture(fixtures.TempDir())
79 78
         hcn.init_logging = mock.MagicMock()
80
-        if six.PY2:
81
-            self.stdin = io.BytesIO()
82
-        else:
83
-            self.stdin = io.StringIO()
79
+        self.stdin = six.StringIO()
84 80
 
85 81
     def write_config_file(self, data):
86 82
         config_file = tempfile.NamedTemporaryFile(mode='w')

+ 2
- 7
tests/test_hook_chef.py View File

@@ -13,7 +13,6 @@
13 13
 
14 14
 import copy
15 15
 import imp
16
-import io
17 16
 import json
18 17
 import logging
19 18
 import mock
@@ -59,12 +58,8 @@ class HookChefTest(common.RunScriptTest):
59 58
             __file__,
60 59
             '..',
61 60
             'heat-config-chef/install.d/hook-chef.py')
62
-        if six.PY2:
63
-            sys.stdin = io.BytesIO()
64
-            sys.stdout = io.BytesIO()
65
-        else:
66
-            sys.stdin = io.StringIO()
67
-            sys.stdout = io.StringIO()
61
+        sys.stdin = six.StringIO()
62
+        sys.stdout = six.StringIO()
68 63
 
69 64
     def tearDown(self):
70 65
         super(HookChefTest, self).tearDown()

Loading…
Cancel
Save