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


Python host_mock.MockHost类代码示例

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


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

示例1: test_start_cmd

    def test_start_cmd(self):
        # Fails on win - see https://bugs.webkit.org/show_bug.cgi?id=84726
        if sys.platform in ("cygwin", "win32"):
            return

        def fake_pid(_):
            host.filesystem.write_text_file("/tmp/WebKit/httpd.pid", "42")
            return True

        host = MockHost()
        host.executive = MockExecutive(should_log=True)
        test_port = test.TestPort(host)
        host.filesystem.write_text_file(test_port._path_to_apache_config_file(), "")

        server = LayoutTestApacheHttpd(test_port, "/mock/output_dir", number_of_servers=4)
        server._check_that_all_ports_are_available = lambda: True
        server._is_server_running_on_all_ports = lambda: True
        server._wait_for_action = fake_pid
        oc = OutputCapture()
        try:
            oc.capture_output()
            server.start()
            server.stop()
        finally:
            _, _, logs = oc.restore_output()
        self.assertIn("StartServers 4", logs)
        self.assertIn("MinSpareServers 4", logs)
        self.assertIn("MaxSpareServers 4", logs)
        self.assertTrue(host.filesystem.exists("/mock/output_dir/httpd.conf"))
开发者ID:rzr,项目名称:Tizen_Crosswalk,代码行数:29,代码来源:apache_http_server_unittest.py

示例2: get_test_config

def get_test_config(test_files=[], result_files=[]):
    # We could grab this from port.layout_tests_dir(), but instantiating a fully mocked port is a pain.
    layout_tests_directory = "/mock-checkout/LayoutTests"
    results_directory = '/WebKitBuild/Debug/layout-test-results'
    host = MockHost()
    for file in test_files:
        file_path = host.filesystem.join(layout_tests_directory, file)
        host.filesystem.files[file_path] = ''
    for file in result_files:
        file_path = host.filesystem.join(results_directory, file)
        host.filesystem.files[file_path] = ''

    class TestMacPort(WebKitPort):
        port_name = "mac"

        def __init__(self, host):
            WebKitPort.__init__(self, host, port_name=self.port_name)

    return TestConfig(
        TestMacPort(host),
        layout_tests_directory,
        results_directory,
        ('mac', 'mac-leopard', 'win', 'linux'),
        host.filesystem,
        host.scm())
开发者ID:ruizhang331,项目名称:WebKit,代码行数:25,代码来源:rebaselineserver_unittest.py

示例3: test_run

 def test_run(self):
     host = MockHost()
     host.executive = MockExecutive2(output='mock-output')
     git_cl = GitCL(host)
     output = git_cl.run(['command'])
     self.assertEqual(output, 'mock-output')
     self.assertEqual(host.executive.calls, [['git', 'cl', 'command']])
开发者ID:mirror,项目名称:chromium,代码行数:7,代码来源:git_cl_unittest.py

示例4: __init__

    def __init__(self, *args, **kwargs):
        MockHost.__init__(self, *args, **kwargs)

        self._deprecated_port = MockPort()
        self.status_server = MockStatusServer()

        self.wakeup_event = threading.Event()
开发者ID:BrianGFlores,项目名称:android_external_svmp_fbstream,代码行数:7,代码来源:mocktool.py

示例5: test_create_branch_with_patch

    def test_create_branch_with_patch(self):
        host = MockHost()
        host.filesystem = MockFileSystem()

        local_wpt = LocalWPT(host)

        local_wpt.create_branch_with_patch('branch-name', 'message', 'patch')
        self.assertEqual(len(host.executive.calls), 9)
开发者ID:mirror,项目名称:chromium,代码行数:8,代码来源:local_wpt_unittest.py

示例6: touched_files

 def touched_files(self, touched_files, fs=None):
     host = MockHost()
     if fs:
         host.filesystem = fs
     else:
         fs = host.filesystem
     port = MockPort(host)
     return (fs, LayoutTestFinder(port, optparse.Values({'skipped': 'always', 'skip_failing_tests': False, 'http': True})).find_touched_tests(touched_files))
开发者ID:edcwconan,项目名称:webkit,代码行数:8,代码来源:layout_test_finder_unittest.py

示例7: test_run_with_auth

 def test_run_with_auth(self):
     host = MockHost()
     host.executive = MockExecutive2(output='mock-output')
     git_cl = GitCL(host, auth_refresh_token_json='token.json')
     git_cl.run(['upload'])
     self.assertEqual(
         host.executive.calls,
         [['git', 'cl', 'upload', '--auth-refresh-token-json', 'token.json']])
开发者ID:mirror,项目名称:chromium,代码行数:8,代码来源:git_cl_unittest.py

示例8: test_check_is_functional_cdb_not_found

    def test_check_is_functional_cdb_not_found(self):
        host = MockHost()
        host.executive = MockExecutive(should_throw=True)

        build_dir = "/mock-checkout/out/Debug"
        host.filesystem.maybe_make_directory(build_dir)
        dump_reader = DumpReaderWin(host, build_dir)

        self.assertFalse(dump_reader.check_is_functional())
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:9,代码来源:dump_reader_win_unittest.py

示例9: test_filesystem_walk

 def test_filesystem_walk(self):
     mock_dir = 'foo'
     mock_files = {'foo/bar/baz': '',
                   'foo/a': '',
                   'foo/b': '',
                   'foo/c': ''}
     host = MockHost()
     host.filesystem = MockFileSystem(files=mock_files)
     self.assertEquals(host.filesystem.walk(mock_dir), [('foo', ['bar'], ['a', 'b', 'c']), ('foo/bar', [], ['baz'])])
开发者ID:mirror,项目名称:chromium,代码行数:9,代码来源:filesystem_mock_unittest.py

示例10: test_skipped_entry_dont_exist

 def test_skipped_entry_dont_exist(self):
     port = MockHost().port_factory.get('qt')
     expectations_dict = OrderedDict()
     expectations_dict['expectations'] = ''
     port.expectations_dict = lambda: expectations_dict
     port.skipped_layout_tests = lambda tests: set(['foo/bar/baz.html'])
     capture = OutputCapture()
     capture.capture_output()
     exp = TestExpectations(port)
     _, _, logs = capture.restore_output()
     self.assertEqual('The following test foo/bar/baz.html from the Skipped list doesn\'t exist\n', logs)
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:11,代码来源:test_expectations_unittest.py

示例11: test_has_changes_in_wpt_looks_at_start_of_string

    def test_has_changes_in_wpt_looks_at_start_of_string(self):
        host = MockHost()

        def run_command_fn(_):
            return ("something/something.html\n"
                    "something/third_party/WebKit/LayoutTests/imported/wpt/something.html\n")

        host.executive = MockExecutive2(run_command_fn=run_command_fn)
        chromium_wpt = ChromiumWPT(host)

        self.assertFalse(chromium_wpt.has_changes_in_wpt('sha'))
开发者ID:mirror,项目名称:chromium,代码行数:11,代码来源:chromium_wpt_unittest.py


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