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


Python TestConfigurationConverter.to_config_set方法代码示例

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


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

示例1: test_macro_expansion

# 需要导入模块: from webkitpy.layout_tests.models.test_configuration import TestConfigurationConverter [as 别名]
# 或者: from webkitpy.layout_tests.models.test_configuration.TestConfigurationConverter import to_config_set [as 别名]
    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)
开发者ID:mirror,项目名称:chromium,代码行数:27,代码来源:test_configuration_unittest.py

示例2: test_macro_expansion

# 需要导入模块: from webkitpy.layout_tests.models.test_configuration import TestConfigurationConverter [as 别名]
# 或者: from webkitpy.layout_tests.models.test_configuration.TestConfigurationConverter import to_config_set [as 别名]
    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)
开发者ID:ollie314,项目名称:chromium,代码行数:26,代码来源:test_configuration_unittest.py

示例3: TestExpectationParser

# 需要导入模块: from webkitpy.layout_tests.models.test_configuration import TestConfigurationConverter [as 别名]
# 或者: from webkitpy.layout_tests.models.test_configuration.TestConfigurationConverter import to_config_set [as 别名]
class TestExpectationParser(object):
    """Provides parsing facilities for lines in the test_expectation.txt file."""

    DUMMY_BUG_MODIFIER = "bug_dummy"
    BUG_MODIFIER_PREFIX = 'bug'
    BUG_MODIFIER_REGEX = 'bug\d+'
    REBASELINE_MODIFIER = 'rebaseline'
    PASS_EXPECTATION = 'pass'
    SKIP_MODIFIER = 'skip'
    SLOW_MODIFIER = 'slow'
    WONTFIX_MODIFIER = 'wontfix'

    TIMEOUT_EXPECTATION = 'timeout'

    MISSING_BUG_WARNING = 'Test lacks BUG modifier.'

    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

    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 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 = TestExpectationLine()
        expectation_line.original_string = test_name
        expectation_line.modifiers = [TestExpectationParser.DUMMY_BUG_MODIFIER, TestExpectationParser.SKIP_MODIFIER]
        # FIXME: It's not clear what the expectations for a skipped test should be; the expectations
        # might be different for different entries in a Skipped file, or from the command line, or from
        # only running parts of the tests. It's also not clear if it matters much.
        expectation_line.modifiers.append(TestExpectationParser.WONTFIX_MODIFIER)
        expectation_line.name = test_name
        # FIXME: we should pass in a more descriptive string here.
        expectation_line.filename = '<Skipped file>'
        expectation_line.line_number = 0
        expectation_line.expectations = [TestExpectationParser.PASS_EXPECTATION]
        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_modifiers(expectation_line)
        self._parse_expectations(expectation_line)

    def _parse_modifiers(self, expectation_line):
        has_wontfix = False
        has_bugid = False
        parsed_specifiers = set()

        modifiers = [modifier.lower() for modifier in expectation_line.modifiers]
        expectations = [expectation.lower() for expectation in expectation_line.expectations]

        if self.SLOW_MODIFIER in modifiers and self.TIMEOUT_EXPECTATION in expectations:
            expectation_line.warnings.append('A test can not be both SLOW and TIMEOUT. If it times out indefinitely, then it should be just TIMEOUT.')

        for modifier in modifiers:
            if modifier in TestExpectations.MODIFIERS:
                expectation_line.parsed_modifiers.append(modifier)
                if modifier == self.WONTFIX_MODIFIER:
                    has_wontfix = True
            elif modifier.startswith(self.BUG_MODIFIER_PREFIX):
                has_bugid = True
                if re.match(self.BUG_MODIFIER_REGEX, modifier):
                    expectation_line.warnings.append('BUG\d+ is not allowed, must be one of BUGCR\d+, BUGWK\d+, BUGV8_\d+, or a non-numeric bug identifier.')
                else:
                    expectation_line.parsed_bug_modifiers.append(modifier)
            else:
                parsed_specifiers.add(modifier)

        if not expectation_line.parsed_bug_modifiers and not has_wontfix and not has_bugid and self._port.warn_if_bug_missing_in_test_expectations():
            expectation_line.warnings.append(self.MISSING_BUG_WARNING)

        if self._allow_rebaseline_modifier and self.REBASELINE_MODIFIER in modifiers:
            expectation_line.warnings.append('REBASELINE should only be used for running rebaseline.py. Cannot be checked in.')

        expectation_line.matching_configurations = self._test_configuration_converter.to_config_set(parsed_specifiers, expectation_line.warnings)
#.........这里部分代码省略.........
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:103,代码来源:test_expectations.py

示例4: test_to_config_set

# 需要导入模块: from webkitpy.layout_tests.models.test_configuration import TestConfigurationConverter [as 别名]
# 或者: from webkitpy.layout_tests.models.test_configuration.TestConfigurationConverter import to_config_set [as 别名]
    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)
开发者ID:mirror,项目名称:chromium,代码行数:62,代码来源:test_configuration_unittest.py

示例5: TestExpectationParser

# 需要导入模块: from webkitpy.layout_tests.models.test_configuration import TestConfigurationConverter [as 别名]
# 或者: from webkitpy.layout_tests.models.test_configuration.TestConfigurationConverter import to_config_set [as 别名]
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
#.........这里部分代码省略.........
开发者ID:Igalia,项目名称:blink,代码行数:103,代码来源:test_expectations.py

示例6: test_to_config_set

# 需要导入模块: from webkitpy.layout_tests.models.test_configuration import TestConfigurationConverter [as 别名]
# 或者: from webkitpy.layout_tests.models.test_configuration.TestConfigurationConverter import to_config_set [as 别名]
    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)
开发者ID:ollie314,项目名称:chromium,代码行数:68,代码来源:test_configuration_unittest.py


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