本文整理汇总了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>"