• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python systemhost_mock.MockSystemHost类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中webkitpy.common.system.systemhost_mock.MockSystemHost的典型用法代码示例。如果您正苦于以下问题:Python MockSystemHost类的具体用法?Python MockSystemHost怎么用?Python MockSystemHost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: test_format_docstrings

    def test_format_docstrings(self):
        host = MockSystemHost()
        host.stdin = StringIO.StringIO(
            '''
def f():
    """
    triple-quoted docstring
    with multiple lines

    """
    x = """
    this is a regular multi-line string, not a docstring
    """
    return x
'''
        )
        main(host, ["-"])
        self.assertMultiLineEqual(
            host.stdout.getvalue(),
            '''
def f():
    """triple-quoted docstring
    with multiple lines
    """
    x = """
    this is a regular multi-line string, not a docstring
    """
    return x
''',
        )
开发者ID:mirror,项目名称:chromium,代码行数:30,代码来源:main_unittest.py


示例2: _assert_skipped_path

 def _assert_skipped_path(self, search_paths, os_name, use_webkit2=False, qt_version='4.8'):
     host = MockSystemHost(os_name=os_name)
     host.executive = MockExecutive2(self._qt_version(qt_version))
     port_name = 'qt-' + os_name
     port = self.make_port(host=host, qt_version=qt_version, port_name=port_name,
                           options=MockOptions(webkit_test_runner=use_webkit2, platform='qt'))
     self.assertEquals(port._skipped_file_search_paths(), search_paths)
开发者ID:,项目名称:,代码行数:7,代码来源:


示例3: make_port

 def make_port(self, executive=None, with_tests=False, **kwargs):
     host = MockSystemHost()
     if executive:
         host.executive = executive
     if with_tests:
         add_unit_tests_to_mock_filesystem(host.filesystem)
         return TestPort(host, **kwargs)
     return Port(host, **kwargs)
开发者ID:Moondee,项目名称:Artemis,代码行数:8,代码来源:base_unittest.py


示例4: _assert_search_path

 def _assert_search_path(self, search_paths, sys_platform, use_webkit2=False, qt_version='4.8'):
     # FIXME: Port constructors should not "parse" the port name, but
     # rather be passed components (directly or via setters).  Once
     # we fix that, this method will need a re-write.
     host = MockSystemHost()
     host.executive = MockExecutive2(self._qt_version(qt_version))
     port = QtPort(host, sys_platform=sys_platform, options=MockOptions(webkit_test_runner=use_webkit2, platform='qt'))
     absolute_search_paths = map(port._webkit_baseline_path, search_paths)
     self.assertEquals(port.baseline_search_path(), absolute_search_paths)
开发者ID:,项目名称:,代码行数:9,代码来源:


示例5: assert_version_properties

 def assert_version_properties(self, port_name, os_version, expected_name,
                               expected_version,
                               driver_file_output=None):
     host = MockSystemHost(os_name=self.os_name, os_version=(os_version or self.os_version))
     host.filesystem.isfile = lambda x: 'content_shell' in x
     if driver_file_output:
         host.executive = executive_mock.MockExecutive2(driver_file_output)
     port = self.make_port(host=host, port_name=port_name, os_version=os_version)
     self.assertEqual(port.name(), expected_name)
     self.assertEqual(port.version(), expected_version)
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:10,代码来源:linux_unittest.py


示例6: _assert_expectations_files

 def _assert_expectations_files(self, search_paths, os_name, use_webkit2=False, qt_version='4.8'):
     # FIXME: Port constructors should not "parse" the port name, but
     # rather be passed components (directly or via setters).  Once
     # we fix that, this method will need a re-write.
     host = MockSystemHost(os_name=os_name)
     host.executive = MockExecutive2(self._qt_version(qt_version))
     port_name = 'qt-' + os_name
     port = self.make_port(host=host, qt_version=qt_version, port_name=port_name,
                           options=MockOptions(webkit_test_runner=use_webkit2, platform='qt'))
     self.assertEquals(port.expectations_files(), search_paths)
开发者ID:,项目名称:,代码行数:10,代码来源:


示例7: test_wdiff_text_fails

    def test_wdiff_text_fails(self):
        host = MockSystemHost(os_name=self.os_name, os_version=self.os_version)
        host.executive = MockExecutive(should_throw=True)
        port = self.make_port(host=host)
        port._executive = host.executive  # AndroidPortTest.make_port sets its own executive, so reset that as well.

        # This should raise a ScriptError that gets caught and turned into the
        # error text, and also mark wdiff as not available.
        self.make_wdiff_available(port)
        self.assertTrue(port.wdiff_available())
        diff_txt = port.wdiff_text("/tmp/foo.html", "/tmp/bar.html")
        self.assertEqual(diff_txt, port._wdiff_error_html)
        self.assertFalse(port.wdiff_available())
开发者ID:,项目名称:,代码行数:13,代码来源:


示例8: test_test_files

    def test_test_files(self):
        host = MockSystemHost()
        files = {
            "/mock-checkout/LayoutTests/canvas/philip/test.html": "",
            "/mock-checkout/LayoutTests/fast/canvas/test.html": "",
            "/mock-checkout/LayoutTests/fast/html/test.html": "",
            "/mock-checkout/LayoutTests/foo/bar.html": "",
        }
        host.filesystem = MockFileSystem(files)

        def test_paths(port_name):
            return PortFactory(host).get(port_name).tests([])

        self.assertEqual(test_paths("chromium-gpu-linux"), set(["canvas/philip/test.html", "fast/canvas/test.html"]))
开发者ID:,项目名称:,代码行数:14,代码来源:


示例9: test_determine_architecture_fails

    def test_determine_architecture_fails(self):
        # Test that we default to 'x86' if the driver doesn't exist.
        port = self.make_port()
        self.assertEqual(port.architecture(), 'x86_64')

        # Test that we default to 'x86' on an unknown architecture.
        host = MockSystemHost()
        host.filesystem.exists = lambda x: True
        host.executive = executive_mock.MockExecutive2('win32')
        port = self.make_port(host=host)
        self.assertEqual(port.architecture(), 'x86_64')

        # Test that we raise errors if something weird happens.
        host.executive = executive_mock.MockExecutive2(exception=AssertionError)
        self.assertRaises(AssertionError, chromium_linux.ChromiumLinuxPort, host, self.port_name)
开发者ID:hinike,项目名称:opera,代码行数:15,代码来源:chromium_linux_unittest.py


示例10: assert_architecture

    def assert_architecture(self, port_name=None, file_output=None, expected_architecture=None):
        host = MockSystemHost()
        host.filesystem.exists = lambda x: 'content_shell' in x
        if file_output:
            host.executive = executive_mock.MockExecutive2(file_output)

        port = self.make_port(host, port_name=port_name)
        self.assertEqual(port.architecture(), expected_architecture)
        if expected_architecture == 'x86':
            self.assertTrue(port.baseline_path().endswith('chromium-linux-x86'))
            self.assertTrue(port.baseline_search_path()[0].endswith('chromium-linux-x86'))
            self.assertTrue(port.baseline_search_path()[1].endswith('chromium-linux'))
        else:
            self.assertTrue(port.baseline_path().endswith('chromium-linux'))
            self.assertTrue(port.baseline_search_path()[0].endswith('chromium-linux'))
开发者ID:hinike,项目名称:opera,代码行数:15,代码来源:chromium_linux_unittest.py


示例11: __init__

    def __init__(self, log_executive=False, executive_throws_when_run=None, initialize_scm_by_default=True, web=None, scm=None):
        MockSystemHost.__init__(self, log_executive, executive_throws_when_run)
        add_unit_tests_to_mock_filesystem(self.filesystem)
        self.web = web or MockWeb()

        self._scm = scm
        # FIXME: we should never initialize the SCM by default, since the real
        # object doesn't either. This has caused at least one bug (see bug 89498).
        if initialize_scm_by_default:
            self.initialize_scm()
        self.buildbot = MockBuildBot()

        # Note: We're using a real PortFactory here.  Tests which don't wish to depend
        # on the list of known ports should override this with a MockPortFactory.
        self.port_factory = PortFactory(self)
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:15,代码来源:host_mock.py


示例12: __init__

    def __init__(self, log_executive=False, executive_throws_when_run=None):
        MockSystemHost.__init__(self, log_executive, executive_throws_when_run)
        add_unit_tests_to_mock_filesystem(self.filesystem)
        self.web = MockWeb()

        self._checkout = MockCheckout()
        self._scm = MockSCM(filesystem=self.filesystem, executive=self.executive)
        # Various pieces of code (wrongly) call filesystem.chdir(checkout_root).
        # Making the checkout_root exist in the mock filesystem makes that chdir not raise.
        self.filesystem.maybe_make_directory(self._scm.checkout_root)

        self.bugs = MockBugzilla()
        self.buildbot = MockBuildBot()
        self._chromium_buildbot = MockBuildBot()

        # Note: We're using a real PortFactory here.  Tests which don't wish to depend
        # on the list of known ports should override this with a MockPortFactory.
        self.port_factory = PortFactory(self)

        self._watch_list = MockWatchList()
开发者ID:Moondee,项目名称:Artemis,代码行数:20,代码来源:host_mock.py


示例13: test_format_docstrings_indentation

    def test_format_docstrings_indentation(self):
        host = MockSystemHost()
        host.stdin = StringIO.StringIO(
            '''
def f():
    """This is a docstring
       With extra indentation on this line.

     """
'''
        )
        main(host, ["-"])
        self.assertMultiLineEqual(
            host.stdout.getvalue(),
            '''
def f():
    """This is a docstring
       With extra indentation on this line.
    """
''',
        )
开发者ID:mirror,项目名称:chromium,代码行数:21,代码来源:main_unittest.py


示例14: assert_port_works

    def assert_port_works(self, port_name, input_name=None, platform=None):
        host = MockSystemHost()
        host.filesystem = FileSystem()  # FIXME: This test should not use a real filesystem!

        # test that we got the right port
        mock_options = MockOptions(accelerated_2d_canvas=None,
                                   accelerated_video=None,
                                   builder_name='foo',
                                   child_processes=None)
        if input_name and platform:
            port = PortFactory(host).get(host, platform=platform, port_name=input_name, options=mock_options)
        else:
            port = PortFactory(host).get(host, port_name=port_name, options=mock_options)
        self.assertTrue(port._options.accelerated_2d_canvas)
        self.assertTrue(port._options.accelerated_video)
        self.assertTrue(port._options.experimental_fully_parallel)
        self.assertEqual(port._options.builder_name, 'foo - GPU')

        self.assertTrue(port.name().startswith(port_name))

        # test that it has the right directories in front of the search path.
        paths = port.baseline_search_path()
        self.assertEqual(port._webkit_baseline_path(port_name), paths[0])
        if port_name == 'chromium-gpu-linux':
            self.assertEqual(port._webkit_baseline_path('chromium-gpu-win'), paths[1])
            self.assertEqual(port._webkit_baseline_path('chromium-gpu'), paths[2])
        else:
            self.assertEqual(port._webkit_baseline_path('chromium-gpu'), paths[1])

        # Test that we're limiting to the correct directories.
        # These two tests are picked mostly at random, but we make sure they
        # exist separately from being filtered out by the port.

        # Note that this is using a real filesystem.
        files = port.tests(None)

        path = 'fast/html/keygen.html'
        self.assertTrue(port._filesystem.exists(port.abspath_for_test(path)))
        self.assertFalse(path in files)
开发者ID:,项目名称:,代码行数:39,代码来源:


示例15: test_stdin_only_double_quoting

 def test_stdin_only_double_quoting(self):
     host = MockSystemHost()
     host.stdin = StringIO.StringIO(ACTUAL_INPUT)
     main(host, ["--no-autopep8", "--double-quote-strings", "-"])
     self.assertMultiLineEqual(host.stdout.getvalue(), EXPECTED_ONLY_DOUBLE_QUOTED_OUTPUT)
开发者ID:mirror,项目名称:chromium,代码行数:5,代码来源:main_unittest.py


示例16: test_stdin_no_changes

 def test_stdin_no_changes(self):
     host = MockSystemHost()
     host.stdin = StringIO.StringIO(ACTUAL_INPUT)
     main(host, ["--no-autopep8", "--leave-strings-alone", "-"])
     self.assertMultiLineEqual(host.stdout.getvalue(), ACTUAL_INPUT)
开发者ID:mirror,项目名称:chromium,代码行数:5,代码来源:main_unittest.py


示例17: test_stdin_chromium

 def test_stdin_chromium(self):
     host = MockSystemHost()
     host.stdin = StringIO.StringIO(ACTUAL_INPUT)
     main(host, ["--chromium", "-"])
     self.assertMultiLineEqual(host.stdout.getvalue(), EXPECTED_CHROMIUM_OUTPUT)
开发者ID:mirror,项目名称:chromium,代码行数:5,代码来源:main_unittest.py


示例18: test_stdin_blink

 def test_stdin_blink(self):
     host = MockSystemHost()
     host.stdin = StringIO.StringIO(ACTUAL_INPUT)
     main(host, ["-"])
     self.assertMultiLineEqual(host.stdout.getvalue(), EXPECTED_BLINK_OUTPUT)
开发者ID:mirror,项目名称:chromium,代码行数:5,代码来源:main_unittest.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python user.User类代码示例发布时间:2022-05-26
下一篇:
Python systemhost.SystemHost类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap