当前位置: 首页>>代码示例>>Python>>正文


Python PortFactory.expected_baselines方法代码示例

本文整理汇总了Python中webkitpy.layout_tests.port.factory.PortFactory.expected_baselines方法的典型用法代码示例。如果您正苦于以下问题:Python PortFactory.expected_baselines方法的具体用法?Python PortFactory.expected_baselines怎么用?Python PortFactory.expected_baselines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在webkitpy.layout_tests.port.factory.PortFactory的用法示例。


在下文中一共展示了PortFactory.expected_baselines方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Rebaseliner

# 需要导入模块: from webkitpy.layout_tests.port.factory import PortFactory [as 别名]
# 或者: from webkitpy.layout_tests.port.factory.PortFactory import expected_baselines [as 别名]

#.........这里部分代码省略.........
            self._rebaselined_tests.append(test)

    def _extract_from_zip_to_tempfile(self, zip_file, filename):
        """Extracts |filename| from |zip_file|, a ZipFileSet. Returns the full
           path name to the extracted file."""
        data = zip_file.read(filename)
        suffix = self._filesystem.splitext(filename)[1]
        tempfile, temp_name = self._filesystem.open_binary_tempfile(suffix)
        tempfile.write(data)
        tempfile.close()
        return temp_name

    def _png_has_same_checksum(self, checksum_path, test, checksum_expected_fullpath):
        """Returns True if the fallback png for |checksum_expected_fullpath|
        contains the same checksum."""
        fs = self._filesystem
        png_fullpath = self._first_fallback_png_for_test(test)

        if not fs.exists(png_fullpath):
            _log.error("  Checksum without png file found! Expected %s to exist." % png_fullpath)
            return False

        with fs.open_binary_file_for_reading(png_fullpath) as filehandle:
            checksum_in_png = read_checksum_from_png.read_checksum(filehandle)
            checksum_in_text_file = fs.read_text_file(checksum_path)
            if checksum_in_png and checksum_in_png != checksum_in_text_file:
                _log.error(
                    "  checksum in %s and %s don't match!  Continuing"
                    " to copy but please investigate." % (checksum_expected_fullpath, png_fullpath)
                )
            return checksum_in_text_file == checksum_in_png

    def _first_fallback_png_for_test(self, test):
        all_baselines = self._rebaseline_port.expected_baselines(test, ".png", True)
        return self._filesystem.join(all_baselines[0][0], all_baselines[0][1])

    def _is_dup_baseline(self, new_baseline, baseline_path, test, suffix, platform):
        """Check whether a baseline is duplicate and can fallback to same
           baseline for another platform. For example, if a test has same
           baseline on linux and windows, then we only store windows
           baseline and linux baseline will fallback to the windows version.

        Args:
          new_baseline: temp filename containing the new baseline results
          baseline_path: baseline expectation file name.
          test: test name.
          suffix: file suffix of the expected results, including dot;
                  e.g. '.txt' or '.png'.
          platform: baseline platform 'mac', 'win' or 'linux'.

        Returns:
          True if the baseline is unnecessary.
          False otherwise.
        """
        all_baselines = self._rebaseline_port.expected_baselines(test, suffix, True)

        for fallback_dir, fallback_file in all_baselines:
            if not fallback_dir or not fallback_file:
                continue

            fallback_fullpath = self._filesystem.normpath(self._filesystem.join(fallback_dir, fallback_file))
            if fallback_fullpath.lower() == baseline_path.lower():
                continue
            fallback_dir_relpath = self._filesystem.relpath(fallback_dir, self._target_port.layout_tests_dir())
            if fallback_dir_relpath == "":
                fallback_dir_relpath = "<generic>"
开发者ID:,项目名称:,代码行数:70,代码来源:


注:本文中的webkitpy.layout_tests.port.factory.PortFactory.expected_baselines方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。