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


Python PortFactory.get方法代码示例

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


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

示例1: test_basic

# 需要导入模块: from webkitpy.layout_tests.port.factory import PortFactory [as 别名]
# 或者: from webkitpy.layout_tests.port.factory.PortFactory import get [as 别名]
    def test_basic(self):
        cmd = [sys.executable, '-c', 'import sys; import time; time.sleep(0.02); print "stdout"; sys.stdout.flush(); print >>sys.stderr, "stderr"']
        host = SystemHost()
        factory = PortFactory(host)
        port = factory.get()
        now = time.time()
        proc = server_process.ServerProcess(port, 'python', cmd)
        proc.write('')

        self.assertEqual(proc.poll(), None)
        self.assertFalse(proc.has_crashed())

        # check that doing a read after an expired deadline returns
        # nothing immediately.
        line = proc.read_stdout_line(now - 1)
        self.assertEqual(line, None)

        # FIXME: This part appears to be flaky. line should always be non-None.
        # FIXME: https://bugs.webkit.org/show_bug.cgi?id=88280
        line = proc.read_stdout_line(now + 1.0)
        if line:
            self.assertEqual(line.strip(), "stdout")

        line = proc.read_stderr_line(now + 1.0)
        if line:
            self.assertEqual(line.strip(), "stderr")

        proc.stop(0)
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:30,代码来源:server_process_unittest.py

示例2: test_path_to_expectations

# 需要导入模块: from webkitpy.layout_tests.port.factory import PortFactory [as 别名]
# 或者: from webkitpy.layout_tests.port.factory.PortFactory import get [as 别名]
 def test_path_to_expectations(self):
     port_factory = PortFactory(MockSystemHost())
     for port_name in ("google-chrome-linux32", "google-chrome-linux64", "google-chrome-mac", "google-chrome-win"):
         self.assertTrue(
             port_factory.get(port_name)
             .path_to_test_expectations_file()
             .endswith("platform/chromium/TestExpectations")
         )
开发者ID:yang-bo,项目名称:webkit,代码行数:10,代码来源:google_chrome_unittest.py

示例3: test_basic

# 需要导入模块: from webkitpy.layout_tests.port.factory import PortFactory [as 别名]
# 或者: from webkitpy.layout_tests.port.factory.PortFactory import get [as 别名]
    def test_basic(self):
        cmd = [sys.executable, '-c', 'import sys; import time; time.sleep(0.02); print "stdout"; sys.stdout.flush(); print >>sys.stderr, "stderr"']
        host = SystemHost()
        factory = PortFactory(host)
        port = factory.get()
        now = time.time()
        proc = server_process.ServerProcess(port, 'python', cmd)
        proc.write('')

        self.assertEquals(proc.poll(), None)
        self.assertFalse(proc.has_crashed())

        # check that doing a read after an expired deadline returns
        # nothing immediately.
        line = proc.read_stdout_line(now - 1)
        self.assertEquals(line, None)

        line = proc.read_stdout_line(now + 1.0)
        self.assertEquals(line.strip(), "stdout")

        line = proc.read_stderr_line(now + 1.0)
        self.assertEquals(line.strip(), "stderr")

        proc.stop()
开发者ID:eth-srl,项目名称:R4,代码行数:26,代码来源:server_process_unittest.py


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