Fix tempest running under python3
Change-Id: I602061f2d544854df4720fa414afd1c1687bf2d5
This commit is contained in:
parent
eceef09870
commit
2531984a01
|
@ -75,7 +75,10 @@ def execute(args, must_fail=False, merge_stderr=False):
|
|||
"""
|
||||
stdout = subprocess.PIPE
|
||||
stderr = subprocess.STDOUT if merge_stderr else subprocess.PIPE
|
||||
proc = subprocess.Popen(args, stdout=stdout, stderr=stderr)
|
||||
proc = subprocess.Popen(args,
|
||||
stdout=stdout,
|
||||
stderr=stderr,
|
||||
universal_newlines=True)
|
||||
result, result_err = proc.communicate()
|
||||
|
||||
if not must_fail and proc.returncode != 0:
|
||||
|
|
|
@ -95,7 +95,7 @@ def load_metadata(path):
|
|||
:param path: the path to load
|
||||
:return: a metadata dict
|
||||
"""
|
||||
with open(path, 'r') as f:
|
||||
with open(path, 'rb') as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
|
@ -172,7 +172,8 @@ class BaseFreezerTest(test.BaseTestCase):
|
|||
proc = subprocess.Popen(sub_process_args,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
env=self.environ, shell=False)
|
||||
env=self.environ, shell=False,
|
||||
universal_newlines=True)
|
||||
|
||||
out, err = proc.communicate()
|
||||
self.assertEqual(0, proc.returncode,
|
||||
|
|
|
@ -85,7 +85,7 @@ class TestFreezerCompressGzip(base.BaseFreezerTest):
|
|||
|
||||
def _metadata(self):
|
||||
path = os.path.join(self.storage_tree.path, 'metadata.json')
|
||||
with open(path, 'r') as f:
|
||||
with open(path, 'rb') as f:
|
||||
return json.load(f)
|
||||
|
||||
def _file_get_mimetype(self, metadata):
|
||||
|
@ -118,7 +118,8 @@ class TestFreezerCompressGzip(base.BaseFreezerTest):
|
|||
|
||||
# run 'file' in brief mode to only output the values we want
|
||||
proc = subprocess.Popen(['file', '-b', '--mime-type', data_file_path],
|
||||
stdout=subprocess.PIPE)
|
||||
stdout=subprocess.PIPE,
|
||||
universal_newlines=True)
|
||||
out, err = proc.communicate()
|
||||
self.assertEqual(0, proc.returncode)
|
||||
|
||||
|
|
|
@ -82,7 +82,8 @@ class TestFreezerMetadataChecksum(base.BaseFreezerTest):
|
|||
process = subprocess.Popen(restore_args,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
env=self.environ, shell=False)
|
||||
env=self.environ, shell=False,
|
||||
universal_newlines=True)
|
||||
out, err = process.communicate()
|
||||
|
||||
# make sure the subprocess exist with an error due to checksum mismatch
|
||||
|
|
|
@ -68,7 +68,8 @@ class BaseFreezerTest(test.BaseTestCase):
|
|||
proc = subprocess.Popen(sub_process_args,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
env=self.environ, shell=False)
|
||||
env=self.environ, shell=False,
|
||||
universal_newlines=True)
|
||||
|
||||
out, err = proc.communicate()
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ class TestFreezerCmdAction(base.BaseFreezerTest):
|
|||
args = ['freezer', 'action-create', '--file',
|
||||
self.filename]
|
||||
out, err = self.run_subprocess(args, "Create a new action")
|
||||
action_id = err.decode().split(' ')[1]
|
||||
action_id = err.split(' ')[1]
|
||||
|
||||
args = ['freezer', 'action-show', action_id]
|
||||
|
||||
|
@ -76,7 +76,7 @@ class TestFreezerCmdAction(base.BaseFreezerTest):
|
|||
args = ['freezer', 'action-create', '--file',
|
||||
self.filename]
|
||||
out, err = self.run_subprocess(args, "Create a new action")
|
||||
action_id = err.decode().split(' ')[1]
|
||||
action_id = err.split(' ')[1]
|
||||
|
||||
args = ['freezer', 'action-delete', action_id]
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ class TestFreezerCmdClient(base.BaseFreezerTest):
|
|||
super(TestFreezerCmdClient, self).setUp()
|
||||
test_clinet_id = '{"project_id": "tecs",\
|
||||
"client_id": "test-tenant_5253_test-hostname_19544",\
|
||||
"hostname": "test-hostname_19544",\
|
||||
"description": "some usefule text here",\
|
||||
"config_id": "config_id_contains_uuid_of_config"\
|
||||
}'
|
||||
|
|
|
@ -68,7 +68,8 @@ class BaseFreezerTest(test.BaseTestCase):
|
|||
proc = subprocess.Popen(sub_process_args,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
env=self.environ, shell=False)
|
||||
env=self.environ, shell=False,
|
||||
universal_newlines=True)
|
||||
|
||||
out, err = proc.communicate()
|
||||
|
||||
|
|
Loading…
Reference in New Issue