Merge "Use six StringIO"

This commit is contained in:
Zuul 2018-03-26 20:29:31 +00:00 committed by Gerrit Code Review
commit 10f28e8491
3 changed files with 5 additions and 15 deletions

View File

@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import io
import json
import logging
import os
@ -82,13 +81,13 @@ def configure_logging():
handler.setFormatter(formatter)
log.addHandler(handler)
deploy_stdout = io.StringIO()
deploy_stdout = six.StringIO()
handler = logging.StreamHandler(deploy_stdout)
handler.setFormatter(formatter)
handler.setLevel('DEBUG')
log.addHandler(handler)
deploy_stderr = io.StringIO()
deploy_stderr = six.StringIO()
handler = logging.StreamHandler(deploy_stderr)
handler.setFormatter(formatter)
handler.setLevel('WARN')

View File

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

View File

@ -13,7 +13,6 @@
import copy
import imp
import io
import json
import logging
import mock
@ -59,12 +58,8 @@ class HookChefTest(common.RunScriptTest):
__file__,
'..',
'heat-config-chef/install.d/hook-chef.py')
if six.PY2:
sys.stdin = io.BytesIO()
sys.stdout = io.BytesIO()
else:
sys.stdin = io.StringIO()
sys.stdout = io.StringIO()
sys.stdin = six.StringIO()
sys.stdout = six.StringIO()
def tearDown(self):
super(HookChefTest, self).tearDown()