summaryrefslogtreecommitdiffstats
path: root/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py')
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
index 3a6e92b..dcc64a3 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
@@ -161,7 +161,10 @@ class TestTypeBase(object):
def _write_into_file_at_path(self, file_path, contents, encoding):
"""This method assumes that byte_array is already encoded
into the right format."""
- with codecs.open(file_path, "w", encoding=encoding) as file:
+ open_mode = 'w'
+ if encoding is None:
+ open_mode = 'w+b'
+ with codecs.open(file_path, open_mode, encoding=encoding) as file:
file.write(contents)
def write_output_files(self, filename, file_type,