aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/tests/_runner.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/grpcio/tests/_runner.py')
-rw-r--r--src/python/grpcio/tests/_runner.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/python/grpcio/tests/_runner.py b/src/python/grpcio/tests/_runner.py
index e899154b0b..173a170409 100644
--- a/src/python/grpcio/tests/_runner.py
+++ b/src/python/grpcio/tests/_runner.py
@@ -42,6 +42,7 @@ import time
import unittest
import uuid
+import six
from six import moves
from tests import _loader
@@ -95,6 +96,8 @@ class CaptureFile(object):
Arguments:
value (str): What to write to the original file.
"""
+ if six.PY3 and not isinstance(value, six.binary_type):
+ value = bytes(value, 'ascii')
if self._saved_fd is None:
os.write(self._redirect_fd, value)
else:
@@ -171,9 +174,9 @@ class Runner(object):
result.stopTestRun()
stdout_pipe.write_bypass(result_out.getvalue())
stdout_pipe.write_bypass(
- '\ninterrupted stdout:\n{}\n'.format(stdout_pipe.output()))
+ '\ninterrupted stdout:\n{}\n'.format(stdout_pipe.output().decode()))
stderr_pipe.write_bypass(
- '\ninterrupted stderr:\n{}\n'.format(stderr_pipe.output()))
+ '\ninterrupted stderr:\n{}\n'.format(stderr_pipe.output().decode()))
os._exit(1)
signal.signal(signal.SIGINT, sigint_handler)
signal.signal(signal.SIGSEGV, fault_handler)
@@ -216,7 +219,7 @@ class Runner(object):
sys.stdout.write(result_out.getvalue())
sys.stdout.flush()
signal.signal(signal.SIGINT, signal.SIG_DFL)
- with open('report.xml', 'w') as report_xml_file:
+ with open('report.xml', 'wb') as report_xml_file:
_result.jenkins_junit_xml(result).write(report_xml_file)
return result