本文整理汇总了Python中webkitpy.common.host_mock.MockHost.ports_parsed方法的典型用法代码示例。如果您正苦于以下问题:Python MockHost.ports_parsed方法的具体用法?Python MockHost.ports_parsed怎么用?Python MockHost.ports_parsed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webkitpy.common.host_mock.MockHost
的用法示例。
在下文中一共展示了MockHost.ports_parsed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_all_configurations
# 需要导入模块: from webkitpy.common.host_mock import MockHost [as 别名]
# 或者: from webkitpy.common.host_mock.MockHost import ports_parsed [as 别名]
def test_all_configurations(self):
class FakePort(object):
def __init__(self, name, path):
self.name = name
self.path = path
def test_expectations(self):
return ''
def path_to_test_expectations_file(self):
return self.path
def test_configuration(self):
return None
def test_expectations_overrides(self):
return None
class FakeFactory(object):
def __init__(self, host, ports):
self.host = host
self.ports = {}
for port in ports:
self.ports[port.name] = port
port.host = host
port.factory = self
def get(self, port_name, *args, **kwargs):
return self.ports[port_name]
def all_port_names(self):
return sorted(self.ports.keys())
class FakeExpectationsParser(object):
def __init__(self, port, *args, **kwargs):
port.host.ports_parsed.append(port.name)
host = MockHost()
host.ports_parsed = []
host.port_factory = FakeFactory(host, (FakePort('a', 'path-to-a'),
FakePort('b', 'path-to-b'),
FakePort('b-win', 'path-to-b')))
self.assertEquals(run_webkit_tests.lint(host.port_factory.ports['a'], MockOptions(platform=None), FakeExpectationsParser), 0)
self.assertEquals(host.ports_parsed, ['a', 'b'])
host.ports_parsed = []
self.assertEquals(run_webkit_tests.lint(host.port_factory.ports['a'], MockOptions(platform='a'), FakeExpectationsParser), 0)
self.assertEquals(host.ports_parsed, ['a'])
示例2: test_all_configurations
# 需要导入模块: from webkitpy.common.host_mock import MockHost [as 别名]
# 或者: from webkitpy.common.host_mock.MockHost import ports_parsed [as 别名]
def test_all_configurations(self):
host = MockHost()
host.ports_parsed = []
host.port_factory = FakeFactory(host, (FakePort(host, 'a', 'path-to-a'),
FakePort(host, 'b', 'path-to-b'),
FakePort(host, 'b-win', 'path-to-b')))
logging_stream = StringIO.StringIO()
options = optparse.Values({'platform': None})
res = lint_test_expectations.lint(host, options, logging_stream)
self.assertEqual(res, 0)
self.assertEqual(host.ports_parsed, ['a', 'b', 'b-win'])
示例3: test_all_configurations
# 需要导入模块: from webkitpy.common.host_mock import MockHost [as 别名]
# 或者: from webkitpy.common.host_mock.MockHost import ports_parsed [as 别名]
def test_all_configurations(self):
host = MockHost()
host.ports_parsed = []
host.port_factory = FakeFactory(host, (FakePort(host, 'a', 'path-to-a'),
FakePort(host, 'b', 'path-to-b'),
FakePort(host, 'b-win', 'path-to-b')))
logging_stream = StringIO.StringIO()
options = optparse.Values({'platform': None})
logger, handler = lint_test_expectations.set_up_logging(logging_stream)
try:
res = lint_test_expectations.lint(host, options)
finally:
lint_test_expectations.tear_down_logging(logger, handler)
self.assertEqual(res, 0)
self.assertEqual(host.ports_parsed, ['a', 'b', 'b-win'])
示例4: test_all_configurations
# 需要导入模块: from webkitpy.common.host_mock import MockHost [as 别名]
# 或者: from webkitpy.common.host_mock.MockHost import ports_parsed [as 别名]
def test_all_configurations(self):
host = MockHost()
host.ports_parsed = []
host.port_factory = FakeFactory(
host,
(FakePort(host, "a", "path-to-a"), FakePort(host, "b", "path-to-b"), FakePort(host, "b-win", "path-to-b")),
)
logging_stream = StringIO.StringIO()
options = optparse.Values({"platform": None})
logger, handler = lint_test_expectations.set_up_logging(logging_stream)
try:
res = lint_test_expectations.lint(host, options)
finally:
lint_test_expectations.tear_down_logging(logger, handler)
self.assertEqual(res, [])
self.assertEqual(host.ports_parsed, ["a", "b", "b-win"])