Skip to content

Commit 155e8c6

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Fix functional tests for Python 3.4"
2 parents a29df98 + b12d850 commit 155e8c6

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

functional/common/test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@
2828

2929
def execute(cmd, fail_ok=False, merge_stderr=False):
3030
"""Executes specified command for the given action."""
31-
cmdlist = shlex.split(cmd.encode('utf-8'))
31+
cmdlist = shlex.split(cmd)
3232
result = ''
3333
result_err = ''
3434
stdout = subprocess.PIPE
3535
stderr = subprocess.STDOUT if merge_stderr else subprocess.PIPE
3636
proc = subprocess.Popen(cmdlist, stdout=stdout, stderr=stderr)
3737
result, result_err = proc.communicate()
38+
result = result.decode('utf-8')
3839
if not fail_ok and proc.returncode != 0:
3940
raise exceptions.CommandFailed(proc.returncode, cmd, result,
4041
result_err)

functional/tests/compute/v2/test_server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ class ServerTests(test.TestCase):
3232
def get_flavor(cls):
3333
raw_output = cls.openstack('flavor list -f value -c ID')
3434
ray = raw_output.split('\n')
35-
idx = len(ray)/2
35+
idx = int(len(ray)/2)
3636
return ray[idx]
3737

3838
@classmethod
3939
def get_image(cls):
4040
raw_output = cls.openstack('image list -f value -c ID')
4141
ray = raw_output.split('\n')
42-
idx = len(ray)/2
42+
idx = int(len(ray)/2)
4343
return ray[idx]
4444

4545
@classmethod
@@ -49,7 +49,7 @@ def get_network(cls):
4949
except exceptions.CommandFailed:
5050
return ''
5151
ray = raw_output.split('\n')
52-
idx = len(ray)/2
52+
idx = int(len(ray)/2)
5353
return ' --nic net-id=' + ray[idx]
5454

5555
@classmethod

0 commit comments

Comments
 (0)