本文整理汇总了Python中webkitpy.layout_tests.models.test_expectations.TestExpectations类的典型用法代码示例。如果您正苦于以下问题:Python TestExpectations类的具体用法?Python TestExpectations怎么用?Python TestExpectations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestExpectations类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _update_expectations_files
def _update_expectations_files(self, lines_to_remove):
# FIXME: This routine is way too expensive. We're creating N ports and N TestExpectations
# objects and (re-)writing the actual expectations file N times, for each test we update.
# We should be able to update everything in memory, once, and then write the file out a single time.
for test in lines_to_remove:
for builder in lines_to_remove[test]:
port = self._tool.port_factory.get_from_builder_name(builder)
path = port.path_to_generic_test_expectations_file()
expectations = TestExpectations(port, include_overrides=False)
for test_configuration in port.all_test_configurations():
if test_configuration.version == port.test_configuration().version:
expectationsString = expectations.remove_configuration_from_test(test, test_configuration)
self._tool.filesystem.write_text_file(path, expectationsString)
for port_name in self._tool.port_factory.all_port_names():
port = self._tool.port_factory.get(port_name)
generic_expectations = TestExpectations(port, tests=[test], include_overrides=False)
if self._port_skips_test(port, test, generic_expectations):
for test_configuration in port.all_test_configurations():
if test_configuration.version == port.test_configuration().version:
expectationsString = generic_expectations.remove_configuration_from_test(
test, test_configuration
)
generic_path = port.path_to_generic_test_expectations_file()
self._tool.filesystem.write_text_file(generic_path, expectationsString)
示例2: _tests_to_rebaseline
def _tests_to_rebaseline(self, port):
tests_to_rebaseline = {}
expectations = TestExpectations(port, include_overrides=True)
for test in expectations.get_rebaselining_failures():
suffixes = TestExpectations.suffixes_for_expectations(expectations.get_expectations(test))
tests_to_rebaseline[test] = suffixes or BASELINE_SUFFIX_LIST
return tests_to_rebaseline
示例3: _update_expectations_files
def _update_expectations_files(self, port_name):
port = self._tool.port_factory.get(port_name)
expectations = TestExpectations(port)
for path in port.expectations_dict():
if self._tool.filesystem.exists(path):
self._tool.filesystem.write_text_file(path, expectations.remove_rebaselined_tests(expectations.get_rebaselining_failures(), path))
示例4: _update_expectations_files
def _update_expectations_files(self, lines_to_remove):
# FIXME: This routine is way too expensive. We're creating O(n ports) TestExpectations objects.
# This is slow and uses a lot of memory.
tests = lines_to_remove.keys()
to_remove = []
# This is so we remove lines for builders that skip this test, e.g. Android skips most
# tests and we don't want to leave stray [ Android ] lines in TestExpectations..
# This is only necessary for "webkit-patch rebaseline" and for rebaselining expected
# failures from garden-o-matic. rebaseline-expectations and auto-rebaseline will always
# pass the exact set of ports to rebaseline.
for port_name in self._tool.port_factory.all_port_names():
port = self._tool.port_factory.get(port_name)
generic_expectations = TestExpectations(port, tests=tests, include_overrides=False)
full_expectations = TestExpectations(port, tests=tests, include_overrides=True)
for test in tests:
if port.skips_test(test, generic_expectations, full_expectations):
for test_configuration in port.all_test_configurations():
if test_configuration.version == port.test_configuration().version:
to_remove.append((test, test_configuration))
for test in lines_to_remove:
for builder in lines_to_remove[test]:
port = self._tool.port_factory.get_from_builder_name(builder)
for test_configuration in port.all_test_configurations():
if test_configuration.version == port.test_configuration().version:
to_remove.append((test, test_configuration))
port = self._tool.port_factory.get()
expectations = TestExpectations(port, include_overrides=False)
expectations_string = expectations.remove_configurations(to_remove)
path = port.path_to_generic_test_expectations_file()
self._tool.filesystem.write_text_file(path, expectations_string)
示例5: _tests_to_rebaseline
def _tests_to_rebaseline(port):
tests_to_rebaseline = {}
for path, value in port.expectations_dict().items():
expectations = TestExpectations(port, include_overrides=False, expectations_dict={path: value})
for test in expectations.get_rebaselining_failures():
suffixes = TestExpectations.suffixes_for_expectations(expectations.get_expectations(test))
tests_to_rebaseline[test] = suffixes or BASELINE_SUFFIX_LIST
return tests_to_rebaseline
示例6: _update_expectations_file
def _update_expectations_file(self, builder_name, test_name):
port = self._tool.port_factory.get_from_builder_name(builder_name)
expectations = TestExpectations(port, include_overrides=False)
for test_configuration in port.all_test_configurations():
if test_configuration.version == port.test_configuration().version:
expectationsString = expectations.remove_configuration_from_test(test_name, test_configuration)
self._tool.filesystem.write_text_file(port.path_to_test_expectations_file(), expectationsString)
示例7: _update_expectations_files
def _update_expectations_files(self, lines_to_remove):
for test in lines_to_remove:
for builder in lines_to_remove[test]:
port = self._tool.port_factory.get_from_builder_name(builder)
path = port.path_to_generic_test_expectations_file()
expectations = TestExpectations(port, include_overrides=False)
for test_configuration in port.all_test_configurations():
if test_configuration.version == port.test_configuration().version:
expectationsString = expectations.remove_configuration_from_test(test, test_configuration)
self._tool.filesystem.write_text_file(path, expectationsString)
示例8: _port_skips_test
def _port_skips_test(self, port, test, generic_expectations):
fs = port.host.filesystem
if port.default_smoke_test_only():
smoke_test_filename = fs.join(port.layout_tests_dir(), 'SmokeTests')
if fs.exists(smoke_test_filename) and test not in fs.read_text_file(smoke_test_filename):
return True
full_expectations = TestExpectations(port, tests=[test], include_overrides=True)
return (SKIP in full_expectations.get_expectations(test) and
SKIP not in generic_expectations.get_expectations(test))
示例9: _update_expectations
def _update_expectations(self):
"""Updates all test expectations that are affected by the move.
"""
_log.info('Updating expectations')
test_expectations = TestExpectations(self._port, include_overrides=False, model_all_expectations=True)
for expectation in self._get_expectations(test_expectations.model(), self._origin):
path = expectation.path
if self._is_child_path(self._origin, path):
# If the existing expectation is a child of the moved path, we simply replace it
# with an expectation for the updated path.
new_path = self._move_path(path, self._origin, self._destination)
_log.debug('Updating expectation for %s to %s' % (path, new_path))
test_expectations.remove_expectation_line(path)
test_expectations.add_expectation_line(testsMover._clone_expectation_line_for_path(expectation, new_path))
else:
# If the existing expectation is not a child of the moved path, we have to leave it
# in place. But we also add a new expectation for the destination path.
new_path = self._destination
_log.warning('Copying expectation for %s to %s. You should check that these expectations are still correct.' %
(path, new_path))
test_expectations.add_expectation_line(testsMover._clone_expectation_line_for_path(expectation, new_path))
expectations_file = self._port.path_to_generic_test_expectations_file()
self._filesystem.write_text_file(expectations_file,
TestExpectations.list_to_string(test_expectations._expectations, reconstitute_only_these=[]))
self._scm.add(self._filesystem.relpath(expectations_file, self._scm.checkout_root))
示例10: did_run_as_expected
def did_run_as_expected(self):
actual_results = self._actual_as_tokens()
expected_results = self._expected_as_tokens()
# FIXME: We should only call remove_pixel_failures when this JSONResult
# came from a test run without pixel tests!
if not TestExpectations.has_pixel_failures(actual_results):
expected_results = TestExpectations.remove_pixel_failures(expected_results)
for actual_result in actual_results:
if not TestExpectations.result_was_expected(actual_result, expected_results, False):
return False
return True
示例11: _suffixes_for_actual_failures
def _suffixes_for_actual_failures(self, test, builder_name, existing_suffixes):
if builder_name not in self.builder_data():
return set()
actual_results = self.builder_data()[builder_name].actual_results(test)
if not actual_results:
return set()
return set(existing_suffixes) & TestExpectations.suffixes_for_actual_expectations_string(actual_results)
示例12: execute
def execute(self, options, args, tool):
factory = self.expectations_factory()
# FIXME: WebKit Linux 32 and WebKit Linux have the same specifiers;
# if we include both of them, we'll get duplicate lines. Ideally
# Linux 32 would have unique speicifiers.
most_builders = builders.all_builder_names()
if 'WebKit Linux 32' in most_builders:
most_builders.remove('WebKit Linux 32')
lines = self._collect_expectation_lines(most_builders, factory)
lines.sort(key=lambda line: line.path)
port = tool.port_factory.get()
# Skip any tests which are mentioned in the dashboard but not in our checkout:
fs = tool.filesystem
lines = filter(lambda line: fs.exists(fs.join(port.layout_tests_dir(), line.path)), lines)
# Note: This includes all flaky tests from the dashboard, even ones mentioned
# in existing TestExpectations. We could certainly load existing TestExpecations
# and filter accordingly, or update existing TestExpectations instead of FlakyTests.
flaky_tests_path = fs.join(port.layout_tests_dir(), 'FlakyTests')
flaky_tests_contents = self.FLAKY_TEST_CONTENTS % TestExpectations.list_to_string(lines)
fs.write_text_file(flaky_tests_path, flaky_tests_contents)
print "Updated %s" % flaky_tests_path
if options.upload:
return self._commit_and_upload(tool, options)
示例13: _copy_existing_baseline
def _copy_existing_baseline(self, builder_name, test_name, suffix):
baseline_directory = self._baseline_directory(builder_name)
ports = [
self._port_for_primary_baseline(baseline)
for baseline in self._immediate_predecessors_in_fallback(baseline_directory)
]
old_baselines = []
new_baselines = []
# Need to gather all the baseline paths before modifying the filesystem since
# the modifications can affect the results of port.expected_filename.
for port in ports:
old_baseline = port.expected_filename(test_name, "." + suffix)
if not self._tool.filesystem.exists(old_baseline):
_log.debug("No existing baseline for %s.", test_name)
continue
new_baseline = self._tool.filesystem.join(
port.baseline_version_dir(), self._file_name_for_expected_result(test_name, suffix)
)
if self._tool.filesystem.exists(new_baseline):
_log.debug("Existing baseline at %s, not copying over it.", new_baseline)
continue
generic_expectations = TestExpectations(port, tests=[test_name], include_overrides=False)
full_expectations = TestExpectations(port, tests=[test_name], include_overrides=True)
# TODO(qyearsley): Change Port.skips_test so that this can be simplified.
if SKIP in full_expectations.get_expectations(test_name):
_log.debug("%s is skipped (perhaps temporarily) on %s.", test_name, port.name())
continue
if port.skips_test(test_name, generic_expectations, full_expectations):
_log.debug("%s is skipped on %s.", test_name, port.name())
continue
old_baselines.append(old_baseline)
new_baselines.append(new_baseline)
for i in range(len(old_baselines)):
old_baseline = old_baselines[i]
new_baseline = new_baselines[i]
_log.debug("Copying baseline from %s to %s.", old_baseline, new_baseline)
self._tool.filesystem.maybe_make_directory(self._tool.filesystem.dirname(new_baseline))
self._tool.filesystem.copyfile(old_baseline, new_baseline)
示例14: get_test_prefix_list
def get_test_prefix_list(self, tests):
test_prefix_list = {}
lines_to_remove = {}
for builder_name in self._release_builders():
port_name = builders.port_name_for_builder_name(builder_name)
port = self._tool.port_factory.get(port_name)
expectations = TestExpectations(port, include_overrides=True)
for test in expectations.get_needs_rebaseline_failures():
if test not in tests:
continue
if test not in test_prefix_list:
lines_to_remove[test] = []
test_prefix_list[test] = {}
lines_to_remove[test].append(builder_name)
test_prefix_list[test][builder_name] = BASELINE_SUFFIX_LIST
return test_prefix_list, lines_to_remove
示例15: _copy_existing_baseline
def _copy_existing_baseline(self, builder_name, test_name, suffix):
baseline_directory = self._baseline_directory(builder_name)
ports = [
self._port_for_primary_baseline(baseline)
for baseline in self._immediate_predecessors_in_fallback(baseline_directory)
]
old_baselines = []
new_baselines = []
# Need to gather all the baseline paths before modifying the filesystem since
# the modifications can affect the results of port.expected_filename.
for port in ports:
old_baseline = port.expected_filename(test_name, "." + suffix)
if not self._tool.filesystem.exists(old_baseline):
_log.debug("No existing baseline for %s." % test_name)
continue
new_baseline = self._tool.filesystem.join(
port.baseline_path(), self._file_name_for_expected_result(test_name, suffix)
)
if self._tool.filesystem.exists(new_baseline):
_log.debug("Existing baseline at %s, not copying over it." % new_baseline)
continue
expectations = TestExpectations(port, [test_name])
if SKIP in expectations.get_expectations(test_name):
_log.debug("%s is skipped on %s." % (test_name, port.name()))
continue
old_baselines.append(old_baseline)
new_baselines.append(new_baseline)
for i in range(len(old_baselines)):
old_baseline = old_baselines[i]
new_baseline = new_baselines[i]
_log.debug("Copying baseline from %s to %s." % (old_baseline, new_baseline))
self._tool.filesystem.maybe_make_directory(self._tool.filesystem.dirname(new_baseline))
self._tool.filesystem.copyfile(old_baseline, new_baseline)
if not self._tool.scm().exists(new_baseline):
self._add_to_scm(new_baseline)