本文整理汇总了Python中webkitpy.layout_tests.models.test_expectations.TestExpectations类的典型用法代码示例。如果您正苦于以下问题:Python TestExpectations类的具体用法?Python TestExpectations怎么用?Python TestExpectations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestExpectations类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:zanxi,项目名称:bitpop,代码行数:25,代码来源:rebaseline.py
示例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
开发者ID:hinike,项目名称:opera,代码行数:7,代码来源:rebaseline.py
示例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))
开发者ID:,项目名称:,代码行数:7,代码来源:
示例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)
开发者ID:mirror,项目名称:chromium,代码行数:33,代码来源:rebaseline.py
示例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
开发者ID:mirror,项目名称:chromium,代码行数:8,代码来源:rebaseline.py
示例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)
开发者ID:,项目名称:,代码行数:9,代码来源:
示例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)
开发者ID:hinike,项目名称:opera,代码行数:10,代码来源:rebaseline.py
示例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))
开发者ID:Igalia,项目名称:blink,代码行数:10,代码来源:rebaseline.py
示例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))
开发者ID:Jamesducque,项目名称:mojo,代码行数:27,代码来源:layout_tests_mover.py
示例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
开发者ID:,项目名称:,代码行数:11,代码来源:
示例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)
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:7,代码来源:rebaseline.py
示例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)
开发者ID:335969568,项目名称:Blink-1,代码行数:28,代码来源:flakytests.py
示例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)
开发者ID:mirror,项目名称:chromium,代码行数:45,代码来源:rebaseline.py
示例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
开发者ID:smilusingjavascript,项目名称:blink,代码行数:19,代码来源:rebaseline.py
示例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)
开发者ID:zanxi,项目名称:bitpop,代码行数:42,代码来源:rebaseline.py
示例16: write_test_expectations
def write_test_expectations(self, test_expectations, test_expectations_file):
"""Writes the given TestExpectations object to the filesystem.
Args:
test_expectations: The TestExpectations object to write.
test_expectations_file: The full file path of the Blink
TestExpectations file. This file will be overwritten.
"""
self._host.filesystem.write_text_file(
test_expectations_file,
TestExpectations.list_to_string(test_expectations, reconstitute_only_these=[]))
开发者ID:,项目名称:,代码行数:11,代码来源:
示例17: execute
def execute(self, options, args, tool):
factory = self.expectations_factory()
lines = self._collect_expectation_lines(builders.all_builder_names(), 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)
print self.FLAKY_TEST_CONTENTS % TestExpectations.list_to_string(lines) # pylint: disable=E1601
开发者ID:Pluto-tv,项目名称:blink-crosswalk,代码行数:11,代码来源:flakytests.py
示例18: _tests_to_rebaseline
def _tests_to_rebaseline(self, port):
tests_to_rebaseline = {}
expectations = TestExpectations(port, include_overrides=True)
expectations.parse_all_expectations()
for test in expectations.get_rebaselining_failures():
tests_to_rebaseline[test] = TestExpectations.suffixes_for_expectations(expectations.model().get_expectations(test))
return tests_to_rebaseline
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:7,代码来源:rebaseline.py
示例19: _flaky_types_in_results
def _flaky_types_in_results(self, results_entry, only_ignore_very_flaky):
flaky_results = set()
# Always include pass as an expected result. Passes will never turn the bot red.
# This fixes cases where the expectations have an implicit Pass, e.g. [ Slow ].
latest_expectations = [PASS]
if self.results_json.EXPECTATIONS_KEY in results_entry:
expectations_list = results_entry[self.results_json.EXPECTATIONS_KEY].split(' ')
latest_expectations += [self._result_to_enum(expectation) for expectation in expectations_list]
for result_item in results_entry[self.results_json.RESULTS_KEY]:
_, result_types_str = self.results_json.occurances_and_type_from_result_item(result_item)
result_types = []
for result_type in result_types_str:
# TODO(ojan): Remove this if-statement once crbug.com/514378 is fixed.
if result_type not in self.NON_RESULT_TYPES:
result_types.append(self.results_json.expectation_for_type(result_type))
# It didn't flake if it didn't retry.
if len(result_types) <= 1:
continue
# If the test ran as expected after only one retry, it's not very flaky.
# It's only very flaky if it failed the first run and the first retry
# and then ran as expected in one of the subsequent retries.
# If there are only two entries, then that means it failed on the first
# try and ran as expected on the second because otherwise we'd have
# a third entry from the next try.
second_result_type_enum_value = self._result_to_enum(result_types[1])
if only_ignore_very_flaky and len(result_types) == 2:
continue
has_unexpected_results = False
for result_type in result_types:
result_enum = self._result_to_enum(result_type)
# TODO(ojan): We really should be grabbing the expected results from the time
# of the run instead of looking at the latest expected results. That's a lot
# more complicated though. So far we've been looking at the aggregated
# results_small.json off test_results.appspot, which has all the information
# for the last 100 runs. In order to do this, we'd need to look at the
# individual runs' full_results.json, which would be slow and more complicated.
# The only thing we lose by not fixing this is that a test that was flaky
# and got fixed will still get printed out until 100 runs have passed.
if not TestExpectations.result_was_expected(result_enum, latest_expectations, test_needs_rebaselining=False):
has_unexpected_results = True
break
if has_unexpected_results:
flaky_results = flaky_results.union(set(result_types))
return flaky_results
开发者ID:,项目名称:,代码行数:52,代码来源:
示例20: get_updated_test_expectations
def get_updated_test_expectations(self):
"""Filters out passing lines from TestExpectations file.
Reads the current TestExpectations file and, using results from the
build bots, removes lines that are passing. That is, removes lines that
were not needed to keep the bots green.
Returns:
A TestExpectations object with the passing lines filtered out.
"""
test_expectations = TestExpectations(self._port, include_overrides=False).expectations()
for expectation in self._expectations_to_remove():
index = test_expectations.index(expectation)
test_expectations.remove(expectation)
# Remove associated comments and whitespace if we've removed the last expectation under
# a comment block. Only remove a comment block if it's not separated from the test
# expectation line by whitespace.
self._remove_associated_comments_and_whitespace(test_expectations, index)
return test_expectations
开发者ID:,项目名称:,代码行数:22,代码来源:
注:本文中的webkitpy.layout_tests.models.test_expectations.TestExpectations类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论