Merge "Fix functional tests for Python 3.4"
This commit is contained in:
		| @@ -28,13 +28,14 @@ EXAMPLE_DIR = os.path.join(ROOT_DIR, 'examples') | ||||
|  | ||||
| def execute(cmd, fail_ok=False, merge_stderr=False): | ||||
|     """Executes specified command for the given action.""" | ||||
|     cmdlist = shlex.split(cmd.encode('utf-8')) | ||||
|     cmdlist = shlex.split(cmd) | ||||
|     result = '' | ||||
|     result_err = '' | ||||
|     stdout = subprocess.PIPE | ||||
|     stderr = subprocess.STDOUT if merge_stderr else subprocess.PIPE | ||||
|     proc = subprocess.Popen(cmdlist, stdout=stdout, stderr=stderr) | ||||
|     result, result_err = proc.communicate() | ||||
|     result = result.decode('utf-8') | ||||
|     if not fail_ok and proc.returncode != 0: | ||||
|         raise exceptions.CommandFailed(proc.returncode, cmd, result, | ||||
|                                        result_err) | ||||
|   | ||||
| @@ -32,14 +32,14 @@ class ServerTests(test.TestCase): | ||||
|     def get_flavor(cls): | ||||
|         raw_output = cls.openstack('flavor list -f value -c ID') | ||||
|         ray = raw_output.split('\n') | ||||
|         idx = len(ray)/2 | ||||
|         idx = int(len(ray)/2) | ||||
|         return ray[idx] | ||||
|  | ||||
|     @classmethod | ||||
|     def get_image(cls): | ||||
|         raw_output = cls.openstack('image list -f value -c ID') | ||||
|         ray = raw_output.split('\n') | ||||
|         idx = len(ray)/2 | ||||
|         idx = int(len(ray)/2) | ||||
|         return ray[idx] | ||||
|  | ||||
|     @classmethod | ||||
| @@ -49,7 +49,7 @@ class ServerTests(test.TestCase): | ||||
|         except exceptions.CommandFailed: | ||||
|             return '' | ||||
|         ray = raw_output.split('\n') | ||||
|         idx = len(ray)/2 | ||||
|         idx = int(len(ray)/2) | ||||
|         return ' --nic net-id=' + ray[idx] | ||||
|  | ||||
|     @classmethod | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jenkins
					Jenkins