diff options
| author | Sirushti Murugesan <sirushti.murugesan@hp.com> | 2015-10-12 17:23:06 +0530 |
|---|---|---|
| committer | Sirushti Murugesan <sirushti.murugesan@hp.com> | 2015-10-12 17:23:06 +0530 |
| commit | b12d8502226f56421bbe90747cf1727222c6e6fa (patch) | |
| tree | 0ed236d1f219d56ff0d01502e55b2fe6239cf6c5 /functional/common | |
| parent | 262af5416b0fad02dee93aed2193cfee761ebd83 (diff) | |
| download | python-openstackclient-b12d8502226f56421bbe90747cf1727222c6e6fa.tar.gz | |
Fix functional tests for Python 3.4
* shlex.split() expects a string. Not bytes.
* decode the bytestring result of subprocess's communicate()
to a string.
Change-Id: I209f67a91dc609b1e30cb9e683d3d6ee63d00069
Diffstat (limited to 'functional/common')
| -rw-r--r-- | functional/common/test.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/functional/common/test.py b/functional/common/test.py index 50d59fd1..2fc355f8 100644 --- a/functional/common/test.py +++ b/functional/common/test.py @@ -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) |
