本文整理汇总了Python中webkitpy.layout_tests.models.test_configuration.TestConfigurationConverter类的典型用法代码示例。如果您正苦于以下问题:Python TestConfigurationConverter类的具体用法?Python TestConfigurationConverter怎么用?Python TestConfigurationConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestConfigurationConverter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_macro_expansion
def test_macro_expansion(self):
converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS)
configs_to_match = set(
[TestConfiguration("vista", "x86", "release"), TestConfiguration("win7", "x86", "release")]
)
self.assertEqual(converter.to_config_set(set(["win", "release"])), configs_to_match)
configs_to_match = set(
[
TestConfiguration("vista", "x86", "release"),
TestConfiguration("win7", "x86", "release"),
TestConfiguration("trusty", "x86_64", "release"),
]
)
self.assertEqual(converter.to_config_set(set(["win", "trusty", "release"])), configs_to_match)
configs_to_match = set(
[
TestConfiguration("vista", "x86", "release"),
TestConfiguration("win7", "x86", "release"),
TestConfiguration("snowleopard", "x86", "release"),
]
)
self.assertEqual(converter.to_config_set(set(["win", "mac", "release"])), configs_to_match)
示例2: test_symmetric_difference
def test_symmetric_difference(self):
self.assertEqual(
TestConfigurationConverter.symmetric_difference([set(["a", "b"]), set(["b", "c"])]), set(["a", "c"])
)
self.assertEqual(
TestConfigurationConverter.symmetric_difference([set(["a", "b"]), set(["b", "c"]), set(["b", "d"])]),
set(["a", "c", "d"]),
)
示例3: __init__
def __init__(self, port, full_test_list, allow_rebaseline_modifier):
self._port = port
self._test_configuration_converter = TestConfigurationConverter(
set(port.all_test_configurations()),
port.configuration_specifier_macros())
self._full_test_list = full_test_list
self._allow_rebaseline_modifier = allow_rebaseline_modifier
示例4: test_macro_expansion
def test_macro_expansion(self):
converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS)
configs_to_match = set([
TestConfiguration('vista', 'x86', 'release'),
TestConfiguration('win7', 'x86', 'release'),
])
self.assertEqual(converter.to_config_set(set(['win', 'release'])), configs_to_match)
configs_to_match = set([
TestConfiguration('vista', 'x86', 'release'),
TestConfiguration('win7', 'x86', 'release'),
TestConfiguration('linux32', 'x86', 'release'),
TestConfiguration('trusty', 'x86_64', 'release'),
])
self.assertEqual(converter.to_config_set(set(['win', 'linux32', 'trusty', 'release'])),
configs_to_match)
configs_to_match = set([
TestConfiguration('vista', 'x86', 'release'),
TestConfiguration('win7', 'x86', 'release'),
TestConfiguration('snowleopard', 'x86', 'release'),
])
self.assertEqual(converter.to_config_set(set(['win', 'mac', 'release'])), configs_to_match)
示例5: test_macro_collapsing
def test_macro_collapsing(self):
macros = {'foo': ['bar', 'baz'], 'people': ['bob', 'alice', 'john']}
specifiers_list = [set(['john', 'godzilla', 'bob', 'alice'])]
TestConfigurationConverter.collapse_macros(macros, specifiers_list)
self.assertEqual(specifiers_list, [set(['people', 'godzilla'])])
specifiers_list = [set(['john', 'godzilla', 'alice'])]
TestConfigurationConverter.collapse_macros(macros, specifiers_list)
self.assertEqual(specifiers_list, [set(['john', 'godzilla', 'alice', 'godzilla'])])
specifiers_list = [set(['bar', 'godzilla', 'baz', 'bob', 'alice', 'john'])]
TestConfigurationConverter.collapse_macros(macros, specifiers_list)
self.assertEqual(specifiers_list, [set(['foo', 'godzilla', 'people'])])
specifiers_list = [set(['bar', 'godzilla', 'baz', 'bob']), set(['bar', 'baz']), set(['people', 'alice', 'bob', 'john'])]
TestConfigurationConverter.collapse_macros(macros, specifiers_list)
self.assertEqual(specifiers_list, [set(['bob', 'foo', 'godzilla']), set(['foo']), set(['people'])])
示例6: test_macro_collapsing
def test_macro_collapsing(self):
macros = {"foo": ["bar", "baz"], "people": ["bob", "alice", "john"]}
specifiers_list = [set(["john", "godzilla", "bob", "alice"])]
TestConfigurationConverter.collapse_macros(macros, specifiers_list)
self.assertEqual(specifiers_list, [set(["people", "godzilla"])])
specifiers_list = [set(["john", "godzilla", "alice"])]
TestConfigurationConverter.collapse_macros(macros, specifiers_list)
self.assertEqual(specifiers_list, [set(["john", "godzilla", "alice", "godzilla"])])
specifiers_list = [set(["bar", "godzilla", "baz", "bob", "alice", "john"])]
TestConfigurationConverter.collapse_macros(macros, specifiers_list)
self.assertEqual(specifiers_list, [set(["foo", "godzilla", "people"])])
specifiers_list = [
set(["bar", "godzilla", "baz", "bob"]),
set(["bar", "baz"]),
set(["people", "alice", "bob", "john"]),
]
TestConfigurationConverter.collapse_macros(macros, specifiers_list)
self.assertEqual(specifiers_list, [set(["bob", "foo", "godzilla"]), set(["foo"]), set(["people"])])
示例7: test_converter_macro_collapsing
def test_converter_macro_collapsing(self):
converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS)
configs_to_match = set(
[TestConfiguration("vista", "x86", "release"), TestConfiguration("win7", "x86", "release")]
)
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["win", "release"])])
configs_to_match = set(
[
TestConfiguration("vista", "x86", "release"),
TestConfiguration("win7", "x86", "release"),
TestConfiguration("precise", "x86_64", "release"),
TestConfiguration("trusty", "x86_64", "release"),
]
)
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["win", "linux", "release"])])
configs_to_match = set(
[
TestConfiguration("vista", "x86", "release"),
TestConfiguration("win7", "x86", "release"),
TestConfiguration("snowleopard", "x86", "release"),
]
)
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["win", "mac", "release"])])
configs_to_match = set(
[
TestConfiguration("vista", "x86", "release"),
TestConfiguration("win7", "x86", "release"),
TestConfiguration("snowleopard", "x86", "release"),
]
)
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["win", "mac", "release"])])
configs_to_match = set(
[TestConfiguration("vista", "x86", "release"), TestConfiguration("win7", "x86", "release")]
)
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["win", "release"])])
示例8: test_converter_macro_collapsing
def test_converter_macro_collapsing(self):
converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS)
configs_to_match = set([
TestConfiguration('vista', 'x86', 'release'),
TestConfiguration('win7', 'x86', 'release'),
])
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'release'])])
configs_to_match = set([
TestConfiguration('vista', 'x86', 'release'),
TestConfiguration('win7', 'x86', 'release'),
TestConfiguration('linux32', 'x86', 'release'),
TestConfiguration('precise', 'x86_64', 'release'),
TestConfiguration('trusty', 'x86_64', 'release'),
])
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'linux', 'release'])])
configs_to_match = set([
TestConfiguration('vista', 'x86', 'release'),
TestConfiguration('win7', 'x86', 'release'),
TestConfiguration('snowleopard', 'x86', 'release'),
])
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'mac', 'release'])])
configs_to_match = set([
TestConfiguration('vista', 'x86', 'release'),
TestConfiguration('win7', 'x86', 'release'),
TestConfiguration('snowleopard', 'x86', 'release'),
])
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'mac', 'release'])])
configs_to_match = set([
TestConfiguration('vista', 'x86', 'release'),
TestConfiguration('win7', 'x86', 'release'),
])
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'release'])])
示例9: test_to_specifier_lists
def test_to_specifier_lists(self):
converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS)
self.assertEqual(converter.to_specifiers_list(set(self._all_test_configurations)), [[]])
self.assertEqual(converter.to_specifiers_list(set()), [])
configs_to_match = set([TestConfiguration("win7", "x86", "release")])
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["release", "win7"])])
configs_to_match = set([TestConfiguration("win7", "x86", "release"), TestConfiguration("win7", "x86", "debug")])
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["win7"])])
configs_to_match = set(
[
TestConfiguration("precise", "x86_64", "debug"),
TestConfiguration("trusty", "x86_64", "debug"),
TestConfiguration("win7", "x86", "release"),
]
)
self.assertEqual(
converter.to_specifiers_list(configs_to_match), [set(["release", "win7"]), set(["debug", "linux"])]
)
configs_to_match = set(
[
TestConfiguration("win7", "x86", "release"),
TestConfiguration("win7", "x86", "release"),
TestConfiguration("trusty", "x86_64", "debug"),
TestConfiguration("precise", "x86_64", "debug"),
TestConfiguration("trusty", "x86_64", "debug"),
TestConfiguration("precise", "x86_64", "debug"),
]
)
self.assertEqual(
converter.to_specifiers_list(configs_to_match), [set(["release", "win7"]), set(["debug", "linux"])]
)
configs_to_match = set(
[
TestConfiguration("win7", "x86", "release"),
TestConfiguration("snowleopard", "x86", "release"),
TestConfiguration("vista", "x86", "release"),
TestConfiguration("precise", "x86_64", "release"),
TestConfiguration("trusty", "x86_64", "release"),
]
)
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["release"])])
configs_to_match = set(
[TestConfiguration("win7", "x86", "release"), TestConfiguration("snowleopard", "x86", "release")]
)
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["win7", "mac", "release"])])
configs_to_match = set(
[
TestConfiguration("snowleopard", "x86", "release"),
TestConfiguration("win7", "x86", "release"),
TestConfiguration("win7", "x86", "debug"),
TestConfiguration("trusty", "x86_64", "release"),
]
)
self.assertEqual(
converter.to_specifiers_list(configs_to_match), [set(["win7"]), set(["release", "mac", "trusty"])]
)
示例10: test_to_config_set
def test_to_config_set(self):
converter = TestConfigurationConverter(self._all_test_configurations)
self.assertEqual(converter.to_config_set(set()), self._all_test_configurations)
self.assertEqual(converter.to_config_set(set(["foo"])), set())
self.assertEqual(converter.to_config_set(set(["win7", "foo"])), set())
errors = []
self.assertEqual(converter.to_config_set(set(["win7", "foo"]), errors), set())
self.assertEqual(errors, ["Unrecognized specifier 'foo'"])
self.assertEqual(converter.to_config_set(set(["win7", "x86_64"])), set())
configs_to_match = set([TestConfiguration("win7", "x86", "release")])
self.assertEqual(converter.to_config_set(set(["win7", "release"])), configs_to_match)
configs_to_match = set(
[
TestConfiguration("snowleopard", "x86", "release"),
TestConfiguration("vista", "x86", "release"),
TestConfiguration("win7", "x86", "release"),
TestConfiguration("precise", "x86_64", "release"),
TestConfiguration("trusty", "x86_64", "release"),
]
)
self.assertEqual(converter.to_config_set(set(["release"])), configs_to_match)
configs_to_match = set(
[
TestConfiguration("precise", "x86_64", "release"),
TestConfiguration("precise", "x86_64", "debug"),
TestConfiguration("trusty", "x86_64", "release"),
TestConfiguration("trusty", "x86_64", "debug"),
]
)
self.assertEqual(converter.to_config_set(set(["x86_64"])), configs_to_match)
configs_to_match = set(
[
TestConfiguration("trusty", "x86_64", "release"),
TestConfiguration("trusty", "x86_64", "debug"),
TestConfiguration("precise", "x86_64", "release"),
TestConfiguration("precise", "x86_64", "debug"),
TestConfiguration("snowleopard", "x86", "release"),
TestConfiguration("snowleopard", "x86", "debug"),
]
)
self.assertEqual(converter.to_config_set(set(["trusty", "precise", "snowleopard"])), configs_to_match)
configs_to_match = set(
[TestConfiguration("snowleopard", "x86", "release"), TestConfiguration("snowleopard", "x86", "debug")]
)
self.assertEqual(converter.to_config_set(set(["snowleopard", "x86"])), configs_to_match)
configs_to_match = set(
[TestConfiguration("trusty", "x86_64", "release"), TestConfiguration("snowleopard", "x86", "release")]
)
self.assertEqual(converter.to_config_set(set(["trusty", "snowleopard", "release"])), configs_to_match)
示例11: __init__
def __init__(self, port, full_test_list, is_lint_mode):
self._port = port
self._test_configuration_converter = TestConfigurationConverter(set(port.all_test_configurations()), port.configuration_specifier_macros())
self._full_test_list = full_test_list
self._is_lint_mode = is_lint_mode
示例12: test_to_config_set
def test_to_config_set(self):
converter = TestConfigurationConverter(self._all_test_configurations)
self.assertEqual(converter.to_config_set(set()), self._all_test_configurations)
self.assertEqual(converter.to_config_set(set(['foo'])), set())
self.assertEqual(converter.to_config_set(set(['win7', 'foo'])), set())
errors = []
self.assertEqual(converter.to_config_set(set(['win7', 'foo']), errors), set())
self.assertEqual(errors, ["Unrecognized specifier 'foo'"])
self.assertEqual(converter.to_config_set(set(['win7', 'x86_64'])), set())
configs_to_match = set([
TestConfiguration('win7', 'x86', 'release'),
])
self.assertEqual(converter.to_config_set(set(['win7', 'release'])), configs_to_match)
configs_to_match = set([
TestConfiguration('snowleopard', 'x86', 'release'),
TestConfiguration('vista', 'x86', 'release'),
TestConfiguration('win7', 'x86', 'release'),
TestConfiguration('linux32', 'x86', 'release'),
TestConfiguration('precise', 'x86_64', 'release'),
TestConfiguration('trusty', 'x86_64', 'release'),
])
self.assertEqual(converter.to_config_set(set(['release'])), configs_to_match)
configs_to_match = set([
TestConfiguration('precise', 'x86_64', 'release'),
TestConfiguration('precise', 'x86_64', 'debug'),
TestConfiguration('trusty', 'x86_64', 'release'),
TestConfiguration('trusty', 'x86_64', 'debug'),
])
self.assertEqual(converter.to_config_set(set(['x86_64'])), configs_to_match)
configs_to_match = set([
TestConfiguration('trusty', 'x86_64', 'release'),
TestConfiguration('trusty', 'x86_64', 'debug'),
TestConfiguration('precise', 'x86_64', 'release'),
TestConfiguration('precise', 'x86_64', 'debug'),
TestConfiguration('snowleopard', 'x86', 'release'),
TestConfiguration('snowleopard', 'x86', 'debug'),
])
self.assertEqual(converter.to_config_set(set(['trusty', 'precise', 'snowleopard'])),
configs_to_match)
configs_to_match = set([
TestConfiguration('linux32', 'x86', 'release'),
TestConfiguration('linux32', 'x86', 'debug'),
TestConfiguration('snowleopard', 'x86', 'release'),
TestConfiguration('snowleopard', 'x86', 'debug'),
])
self.assertEqual(converter.to_config_set(set(['linux32', 'snowleopard', 'x86'])),
configs_to_match)
configs_to_match = set([
TestConfiguration('trusty', 'x86_64', 'release'),
TestConfiguration('linux32', 'x86', 'release'),
TestConfiguration('snowleopard', 'x86', 'release'),
])
self.assertEqual(
converter.to_config_set(set(['trusty', 'linux32', 'snowleopard', 'release'])),
configs_to_match)
示例13: test_specifier_converter_access
def test_specifier_converter_access(self):
specifier_sorter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS).specifier_sorter()
self.assertEqual(specifier_sorter.category_for_specifier("snowleopard"), "version")
self.assertEqual(specifier_sorter.category_for_specifier("mac"), "version")
示例14: test_to_specifier_lists
def test_to_specifier_lists(self):
converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS)
self.assertEqual(converter.to_specifiers_list(set(self._all_test_configurations)), [[]])
self.assertEqual(converter.to_specifiers_list(set()), [])
configs_to_match = set([
TestConfiguration('win7', 'x86', 'release'),
])
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['release', 'win7'])])
configs_to_match = set([
TestConfiguration('win7', 'x86', 'release'),
TestConfiguration('win7', 'x86', 'debug'),
])
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win7'])])
configs_to_match = set([
TestConfiguration('linux32', 'x86', 'debug'),
TestConfiguration('precise', 'x86_64', 'debug'),
TestConfiguration('trusty', 'x86_64', 'debug'),
TestConfiguration('win7', 'x86', 'release'),
])
self.assertEqual(converter.to_specifiers_list(configs_to_match),
[set(['release', 'win7']), set(['debug', 'linux'])])
configs_to_match = set([
TestConfiguration('win7', 'x86', 'release'),
TestConfiguration('win7', 'x86', 'release'),
TestConfiguration('trusty', 'x86_64', 'debug'),
TestConfiguration('precise', 'x86_64', 'debug'),
TestConfiguration('linux32', 'x86', 'debug'),
TestConfiguration('trusty', 'x86_64', 'debug'),
TestConfiguration('precise', 'x86_64', 'debug'),
TestConfiguration('linux32', 'x86', 'debug'),
])
self.assertEqual(converter.to_specifiers_list(configs_to_match),
[set(['release', 'win7']), set(['debug', 'linux'])])
configs_to_match = set([
TestConfiguration('win7', 'x86', 'release'),
TestConfiguration('snowleopard', 'x86', 'release'),
TestConfiguration('vista', 'x86', 'release'),
TestConfiguration('linux32', 'x86', 'release'),
TestConfiguration('precise', 'x86_64', 'release'),
TestConfiguration('trusty', 'x86_64', 'release'),
])
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['release'])])
configs_to_match = set([
TestConfiguration('win7', 'x86', 'release'),
TestConfiguration('snowleopard', 'x86', 'release'),
])
self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win7', 'mac', 'release'])])
configs_to_match = set([
TestConfiguration('snowleopard', 'x86', 'release'),
TestConfiguration('win7', 'x86', 'release'),
TestConfiguration('win7', 'x86', 'debug'),
TestConfiguration('trusty', 'x86_64', 'release'),
])
self.assertEqual(converter.to_specifiers_list(configs_to_match),
[set(['win7']), set(['release', 'mac', 'trusty'])])
示例15: TestExpectationParser
class TestExpectationParser(object):
"""Provides parsing facilities for lines in the test_expectation.txt file."""
# FIXME: Rename these to *_KEYWORD as in MISSING_KEYWORD above, but make the case studdly-caps to match the actual file contents.
REBASELINE_MODIFIER = 'rebaseline'
NEEDS_REBASELINE_MODIFIER = 'needsrebaseline'
NEEDS_MANUAL_REBASELINE_MODIFIER = 'needsmanualrebaseline'
PASS_EXPECTATION = 'pass'
SKIP_MODIFIER = 'skip'
SLOW_MODIFIER = 'slow'
WONTFIX_MODIFIER = 'wontfix'
TIMEOUT_EXPECTATION = 'timeout'
MISSING_BUG_WARNING = 'Test lacks BUG specifier.'
def __init__(self, port, full_test_list, is_lint_mode):
self._port = port
self._test_configuration_converter = TestConfigurationConverter(set(port.all_test_configurations()), port.configuration_specifier_macros())
self._full_test_list = full_test_list
self._is_lint_mode = is_lint_mode
def parse(self, filename, expectations_string):
expectation_lines = []
line_number = 0
for line in expectations_string.split("\n"):
line_number += 1
test_expectation = self._tokenize_line(filename, line, line_number)
self._parse_line(test_expectation)
expectation_lines.append(test_expectation)
return expectation_lines
def _create_expectation_line(self, test_name, expectations, file_name):
expectation_line = TestExpectationLine()
expectation_line.original_string = test_name
expectation_line.name = test_name
expectation_line.filename = file_name
expectation_line.expectations = expectations
return expectation_line
def expectation_line_for_test(self, test_name, expectations):
expectation_line = self._create_expectation_line(test_name, expectations, '<Bot TestExpectations>')
self._parse_line(expectation_line)
return expectation_line
def expectation_for_skipped_test(self, test_name):
if not self._port.test_exists(test_name):
_log.warning('The following test %s from the Skipped list doesn\'t exist' % test_name)
expectation_line = self._create_expectation_line(test_name, [TestExpectationParser.PASS_EXPECTATION], '<Skipped file>')
expectation_line.expectations = [TestExpectationParser.SKIP_MODIFIER, TestExpectationParser.WONTFIX_MODIFIER]
expectation_line.is_skipped_outside_expectations_file = True
self._parse_line(expectation_line)
return expectation_line
def _parse_line(self, expectation_line):
if not expectation_line.name:
return
if not self._check_test_exists(expectation_line):
return
expectation_line.is_file = self._port.test_isfile(expectation_line.name)
if expectation_line.is_file:
expectation_line.path = expectation_line.name
else:
expectation_line.path = self._port.normalize_test_name(expectation_line.name)
self._collect_matching_tests(expectation_line)
self._parse_specifiers(expectation_line)
self._parse_expectations(expectation_line)
def _parse_specifiers(self, expectation_line):
if self._is_lint_mode:
self._lint_line(expectation_line)
parsed_specifiers = set([specifier.lower() for specifier in expectation_line.specifiers])
expectation_line.matching_configurations = self._test_configuration_converter.to_config_set(parsed_specifiers, expectation_line.warnings)
def _lint_line(self, expectation_line):
expectations = [expectation.lower() for expectation in expectation_line.expectations]
if not expectation_line.bugs and self.WONTFIX_MODIFIER not in expectations:
expectation_line.warnings.append(self.MISSING_BUG_WARNING)
if self.REBASELINE_MODIFIER in expectations:
expectation_line.warnings.append('REBASELINE should only be used for running rebaseline.py. Cannot be checked in.')
def _parse_expectations(self, expectation_line):
result = set()
for part in expectation_line.expectations:
expectation = TestExpectations.expectation_from_string(part)
if expectation is None: # Careful, PASS is currently 0.
expectation_line.warnings.append('Unsupported expectation: %s' % part)
continue
result.add(expectation)
expectation_line.parsed_expectations = result
def _check_test_exists(self, expectation_line):
# WebKit's way of skipping tests is to add a -disabled suffix.
# So we should consider the path existing if the path or the
#.........这里部分代码省略.........