From 92481ac96a66984ed8027fb367a331e919421f17 Mon Sep 17 00:00:00 2001 From: John Chilton <jmchilton@gmail.com> Date: Sun, 10 Apr 2016 16:41:58 -0400 Subject: [PATCH] Python 3 fix for integration tests. --- pulsar/client/test/check.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pulsar/client/test/check.py b/pulsar/client/test/check.py index 9273b642..25c69cd9 100644 --- a/pulsar/client/test/check.py +++ b/pulsar/client/test/check.py @@ -417,8 +417,10 @@ def __write_to_file(path, contents): dirname = os.path.dirname(path) if not os.path.exists(dirname): os.makedirs(dirname) - with open(path, "wb") as file: - file.write(contents) + with open(path, "wb") as f: + if not isinstance(contents, binary_type): + contents = binary_type(contents, "UTF-8") + f.write(contents) def __makedirs(directories): -- GitLab