From 3f77f6d5e0a63aed64d58fb8e8276b098cef2486 Mon Sep 17 00:00:00 2001 From: Trung Tran Date: Sun, 20 Jan 2019 02:00:52 -0800 Subject: devtest: add universal_newlines to subprocess call subprocess call in python3+ return stderr and stdout object is byte object instead of text. This caused many issue with parsing the ouput in devtest. These are not an issue in python2. This change will make devtest more python3 compatible. Signed-off-by: Trung.Tran --- host/tests/devtest/run_testsuite.py | 1 + host/tests/devtest/uhd_test_base.py | 3 ++- host/tests/devtest/usrp_probe.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'host/tests/devtest') diff --git a/host/tests/devtest/run_testsuite.py b/host/tests/devtest/run_testsuite.py index e243a4cda..99871b150 100755 --- a/host/tests/devtest/run_testsuite.py +++ b/host/tests/devtest/run_testsuite.py @@ -122,6 +122,7 @@ def main(): stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + universal_newlines=True ) print(proc.communicate()[0]) sys.stdout.flush() diff --git a/host/tests/devtest/uhd_test_base.py b/host/tests/devtest/uhd_test_base.py index d77226941..8d965eef7 100755 --- a/host/tests/devtest/uhd_test_base.py +++ b/host/tests/devtest/uhd_test_base.py @@ -77,7 +77,8 @@ class shell_application(object): stdout=PIPE, stderr=PIPE, close_fds=True, - env=env + env=env, + universal_newlines=True ) self.stdout, self.stderr = proc.communicate() self.returncode = proc.returncode diff --git a/host/tests/devtest/usrp_probe.py b/host/tests/devtest/usrp_probe.py index 43dd999c1..c7b73288e 100644 --- a/host/tests/devtest/usrp_probe.py +++ b/host/tests/devtest/usrp_probe.py @@ -17,7 +17,7 @@ def get_usrp_list(device_filter=None, env=None): cmd = ['uhd_find_devices'] if device_filter is not None: cmd += ['--args', device_filter] - output = subprocess.check_output(cmd, env=env) + output = subprocess.check_output(cmd, env=env, universal_newlines=True) except subprocess.CalledProcessError: return [] split_re = "\n*-+\n-- .*\n-+\n" -- cgit v1.2.3