From 7675e433fe9f09825ac5045712bc094f09e0f5c6 Mon Sep 17 00:00:00 2001 From: Eric Gribkoff Date: Mon, 23 Mar 2020 20:07:46 -0700 Subject: [PATCH] fix encoding issue with python 3 --- tools/run_tests/run_xds_tests.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/run_tests/run_xds_tests.py b/tools/run_tests/run_xds_tests.py index f518d12e06f..1deac8db5a5 100755 --- a/tools/run_tests/run_xds_tests.py +++ b/tools/run_tests/run_xds_tests.py @@ -1107,10 +1107,13 @@ try: result.returncode = 0 except Exception as e: result.state = 'FAILED' - result.message = str(e).encode('UTF-8') + result.message = str(e) finally: if client_process: client_process.terminate() + # Workaround for Python 3, as report_utils will invoke decode() on + # result.message, which has a default value of ''. + result.message = result.message.encode('UTF-8') test_results[test_case] = [result] if not os.path.exists(_TEST_LOG_BASE_DIR): os.makedirs(_TEST_LOG_BASE_DIR)