Changeset 58016 in webkit


Ignore:
Timestamp:
Apr 21, 2010 3:51:44 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-21 Eric Seidel <eric@webkit.org>

Unreviewed, just fixing exception seen on builders.

REGRESSION(57531): the commit-queue still hates Tor Arne Vestbø
https://bugs.webkit.org/show_bug.cgi?id=37765

  • Scripts/webkitpy/layout_tests/test_types/test_type_base.py:
    • Pass and encoding to _write_into_file_at_path
Location:
trunk/WebKitTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r58014 r58016  
     12010-04-21  Eric Seidel  <eric@webkit.org>
     2
     3        Unreviewed, just fixing exception seen on builders.
     4
     5        REGRESSION(57531): the commit-queue still hates Tor Arne Vestbø
     6        https://bugs.webkit.org/show_bug.cgi?id=37765
     7
     8        * Scripts/webkitpy/layout_tests/test_types/test_type_base.py:
     9         - Pass and encoding to _write_into_file_at_path
     10
    1112010-04-21  Eric Seidel  <eric@webkit.org>
    212
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py

    r58014 r58016  
    154154        raise NotImplemented
    155155
    156     def _write_into_file_at_path(self, file_path, byte_array):
    157         """This method assumes that byte_array is already encoded
    158         into the right format."""
    159         with open(file_path, "wb") as file:
    160             file.write(byte_array)
     156    def _write_into_file_at_path(self, file_path, contents, encoding=None):
     157        """Writes contents at file_path, using encoding."""
     158        with codecs.open(file_path, "w", encoding) as file:
     159            file.write(contents)
    161160
    162161    def write_output_files(self, port, filename, file_type,
     
    180179        actual_filename = self.output_filename(filename, self.FILENAME_SUFFIX_ACTUAL + file_type)
    181180        expected_filename = self.output_filename(filename, self.FILENAME_SUFFIX_EXPECTED + file_type)
     181        # FIXME: The fact that this function can take many different
     182        # types of data is a total hack.
     183        encoding = "utf-8" if print_text_diffs else None
    182184        if output:
    183             self._write_into_file_at_path(actual_filename, output)
     185            self._write_into_file_at_path(actual_filename, output, encoding)
    184186        if expected:
    185             self._write_into_file_at_path(expected_filename, expected)
     187            self._write_into_file_at_path(expected_filename, expected, encoding)
    186188
    187189        if not output or not expected:
     
    193195        diff = port.diff_text(expected, output, expected_filename, actual_filename)
    194196        diff_filename = self.output_filename(filename, self.FILENAME_SUFFIX_DIFF + file_type)
    195         self._write_into_file_at_path(diff_filename, diff.encode("utf-8"))
     197        self._write_into_file_at_path(diff_filename, diff, encoding="utf-8")
    196198
    197199        # Shell out to wdiff to get colored inline diffs.
    198200        wdiff = port.wdiff_text(expected_filename, actual_filename)
    199201        wdiff_filename = self.output_filename(filename, self.FILENAME_SUFFIX_WDIFF)
    200         self._write_into_file_at_path(wdiff_filename, wdiff.encode("utf-8"))
     202        self._write_into_file_at_path(wdiff_filename, wdiff, encoding="utf-8")
    201203
    202204        # Use WebKit's PrettyPatch.rb to get an HTML diff.
    203205        pretty_patch = port.pretty_patch_text(diff_filename)
    204206        pretty_patch_filename = self.output_filename(filename, self.FILENAME_SUFFIX_PRETTY_PATCH)
    205         self._write_into_file_at_path(pretty_patch_filename, pretty_patch.encode("utf-8"))
     207        self._write_into_file_at_path(pretty_patch_filename, pretty_patch, encoding="utf-8")
Note: See TracChangeset for help on using the changeset viewer.