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

Python executive.Executive类代码示例

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

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



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

示例1: serial_test_running_pids

    def serial_test_running_pids(self):
        if sys.platform.startswith('win') or sys.platform == "cygwin":
            return  # This function isn't implemented on Windows yet.

        executive = Executive()
        pids = executive.running_pids()
        self.assertIn(os.getpid(), pids)
开发者ID:edcwconan,项目名称:webkit,代码行数:7,代码来源:executive_unittest.py


示例2: test_running_pids

    def test_running_pids(self):
        if sys.platform in ("win32", "cygwin"):
            return  # This function isn't implemented on Windows yet.

        executive = Executive()
        pids = executive.running_pids()
        self.assertTrue(os.getpid() in pids)
开发者ID:dzhshf,项目名称:WebKit,代码行数:7,代码来源:executive_unittest.py


示例3: test_coverage_works

    def test_coverage_works(self):
        # This is awkward; by design, running test-webkitpy -c will
        # create a .coverage file in tools, so we need to be
        # careful not to clobber an existing one, and to clean up.
        # FIXME: This design needs to change since it means we can't actually
        # run this method itself under coverage properly.
        filesystem = FileSystem()
        executive = Executive()
        module_path = filesystem.path_to_module(self.__module__)
        script_dir = module_path[0:module_path.find('webkitpy') - 1]
        coverage_file = filesystem.join(script_dir, '.coverage')
        coverage_file_orig = None
        if filesystem.exists(coverage_file):
            coverage_file_orig = coverage_file + '.orig'
            filesystem.move(coverage_file, coverage_file_orig)

        try:
            proc = executive.popen([sys.executable, filesystem.join(script_dir, 'test-webkitpy'), '-c', STUBS_CLASS + '.test_empty'],
                                stdout=executive.PIPE, stderr=executive.PIPE)
            out, _ = proc.communicate()
            retcode = proc.returncode
            self.assertEqual(retcode, 0)
            self.assertIn('Cover', out)
        finally:
            if coverage_file_orig:
                filesystem.move(coverage_file_orig, coverage_file)
            elif filesystem.exists(coverage_file):
                filesystem.remove(coverage_file)
开发者ID:Jamesducque,项目名称:mojo,代码行数:28,代码来源:main_unittest.py


示例4: test_run_command_with_unicode

    def test_run_command_with_unicode(self):
        """Validate that it is safe to pass unicode() objects
        to Executive.run* methods, and they will return unicode()
        objects by default unless decode_output=False"""
        unicode_tor_input = u"WebKit \u2661 Tor Arne Vestb\u00F8!"
        if sys.platform == 'win32':
            encoding = 'mbcs'
        else:
            encoding = 'utf-8'
        encoded_tor = unicode_tor_input.encode(encoding)
        # On Windows, we expect the unicode->mbcs->unicode roundtrip to be
        # lossy. On other platforms, we expect a lossless roundtrip.
        if sys.platform == 'win32':
            unicode_tor_output = encoded_tor.decode(encoding)
        else:
            unicode_tor_output = unicode_tor_input

        executive = Executive()

        output = executive.run_command(command_line('cat'), input=unicode_tor_input)
        self.assertEqual(output, unicode_tor_output)

        output = executive.run_command(command_line('echo', unicode_tor_input))
        self.assertEqual(output, unicode_tor_output)

        output = executive.run_command(command_line('echo', unicode_tor_input), decode_output=False)
        self.assertEqual(output, encoded_tor)

        # Make sure that str() input also works.
        output = executive.run_command(command_line('cat'), input=encoded_tor, decode_output=False)
        self.assertEqual(output, encoded_tor)
开发者ID:b-cuts,项目名称:blink-crosswalk,代码行数:31,代码来源:executive_unittest.py


示例5: test_kill_process

    def test_kill_process(self):
        executive = Executive()
        process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
        self.assertEqual(process.poll(), None)  # Process is running
        executive.kill_process(process.pid)

        # Killing again should fail silently.
        executive.kill_process(process.pid)
开发者ID:b-cuts,项目名称:blink-crosswalk,代码行数:8,代码来源:executive_unittest.py


示例6: _run_pylint

 def _run_pylint(self, path):
     wkf = WebKitFinder(FileSystem())
     executive = Executive()
     return executive.run_command([sys.executable, wkf.path_from_depot_tools_base('pylint.py'),
                                   '--output-format=parseable',
                                   '--errors-only',
                                   '--rcfile=' + wkf.path_from_webkit_base('Tools', 'Scripts', 'webkitpy', 'pylintrc'),
                                   path],
                                   error_handler=executive.ignore_error)
开发者ID:,项目名称:,代码行数:9,代码来源:


示例7: integration_test_run_wdiff

 def integration_test_run_wdiff(self):
     executive = Executive()
     # This may fail on some systems.  We could ask the port
     # object for the wdiff path, but since we don't know what
     # port object to use, this is sufficient for now.
     try:
         wdiff_path = executive.run_command(["which", "wdiff"]).rstrip()
     except Exception, e:
         wdiff_path = None
开发者ID:Moondee,项目名称:Artemis,代码行数:9,代码来源:base_unittest.py


示例8: test_kill_all

 def test_kill_all(self):
     executive = Executive()
     # FIXME: This may need edits to work right on windows.
     # We use "yes" because it loops forever.
     process = subprocess.Popen(["yes"], stdout=subprocess.PIPE)
     self.assertEqual(process.poll(), None)  # Process is running
     executive.kill_all("yes")
     self.assertEqual(process.wait(), -signal.SIGTERM)
     # Killing again should fail silently.
     executive.kill_all("yes")
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:10,代码来源:executive_unittest.py


示例9: integration_test_coverage_works

 def integration_test_coverage_works(self):
     filesystem = FileSystem()
     executive = Executive()
     module_path = filesystem.path_to_module(self.__module__)
     script_dir = module_path[0:module_path.find('webkitpy') - 1]
     proc = executive.popen([sys.executable, filesystem.join(script_dir, 'test-webkitpy'), '-c', STUBS_CLASS + '.test_empty'],
                            stdout=executive.PIPE, stderr=executive.PIPE)
     out, _ = proc.communicate()
     retcode = proc.returncode
     self.assertEqual(retcode, 0)
     self.assertIn('Cover', out)
开发者ID:Igalia,项目名称:blink,代码行数:11,代码来源:main_unittest.py


示例10: serial_test_kill_process

    def serial_test_kill_process(self):
        if sys.platform in ("win32", "cygwin"):
            return  # Windows does not return consistent exit codes.

        executive = Executive()
        process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
        self.assertEqual(process.poll(), None)  # Process is running
        executive.kill_process(process.pid)
        self.assertEqual(process.wait(), -signal.SIGKILL)

        # Killing again should fail silently.
        executive.kill_process(process.pid)
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:12,代码来源:executive_unittest.py


示例11: test_kill_process

 def test_kill_process(self):
     executive = Executive()
     process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
     self.assertEqual(process.poll(), None)  # Process is running
     executive.kill_process(process.pid)
     # Note: Can't use a ternary since signal.SIGKILL is undefined for sys.platform == "win32"
     if sys.platform == "win32":
         expected_exit_code = 1
     else:
         expected_exit_code = -signal.SIGKILL
     self.assertEqual(process.wait(), expected_exit_code)
     # Killing again should fail silently.
     executive.kill_process(process.pid)
开发者ID:Andersbakken,项目名称:check-coding-style,代码行数:13,代码来源:executive_unittest.py


示例12: _run_pylint

 def _run_pylint(self, path):
     wkf = WebKitFinder(FileSystem())
     executive = Executive()
     env = os.environ.copy()
     env['PYTHONPATH'] = ('%s%s%s' % (wkf.path_from_webkit_base('Tools', 'Scripts'),
                                      os.pathsep,
                                      wkf.path_from_webkit_base('Tools', 'Scripts', 'webkitpy', 'thirdparty')))
     return executive.run_command([sys.executable, wkf.path_from_depot_tools_base('pylint.py'),
                                   '--output-format=parseable',
                                   '--errors-only',
                                   '--rcfile=' + wkf.path_from_webkit_base('Tools', 'Scripts', 'webkitpy', 'pylintrc'),
                                   path],
                                  env=env,
                                  error_handler=executive.ignore_error)
开发者ID:rzr,项目名称:Tizen_Crosswalk,代码行数:14,代码来源:python.py


示例13: test_kill_process

 def test_kill_process(self):
     executive = Executive()
     # We use "yes" because it loops forever.
     process = subprocess.Popen(["yes"], stdout=subprocess.PIPE)
     self.assertEqual(process.poll(), None)  # Process is running
     executive.kill_process(process.pid)
     # Note: Can't use a ternary since signal.SIGKILL is undefined for sys.platform == "win32"
     if sys.platform == "win32":
         expected_exit_code = 0  # taskkill.exe results in exit(0)
     else:
         expected_exit_code = -signal.SIGKILL
     self.assertEqual(process.wait(), expected_exit_code)
     # Killing again should fail silently.
     executive.kill_process(process.pid)
开发者ID:,项目名称:,代码行数:14,代码来源:


示例14: test_kill_process

 def test_kill_process(self):
     executive = Executive()
     process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
     self.assertEqual(process.poll(), None)  # Process is running
     executive.kill_process(process.pid)
     # Note: Can't use a ternary since signal.SIGKILL is undefined for sys.platform == "win32"
     if sys.platform == "win32":
         # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54790
         # We seem to get either 0 or 1 here for some reason.
         self.assertTrue(process.wait() in (0, 1))
     else:
         expected_exit_code = -signal.SIGKILL
         self.assertEqual(process.wait(), expected_exit_code)
     # Killing again should fail silently.
     executive.kill_process(process.pid)
开发者ID:dzhshf,项目名称:WebKit,代码行数:15,代码来源:executive_unittest.py


示例15: test_kill_all

 def test_kill_all(self):
     executive = Executive()
     # We use "yes" because it loops forever.
     process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
     self.assertEqual(process.poll(), None)  # Process is running
     executive.kill_all(never_ending_command()[0])
     # Note: Can't use a ternary since signal.SIGTERM is undefined for sys.platform == "win32"
     if sys.platform == "cygwin":
         expected_exit_code = 0  # os.kill results in exit(0) for this process.
     elif sys.platform == "win32":
         expected_exit_code = 1
     else:
         expected_exit_code = -signal.SIGTERM
     self.assertEqual(process.wait(), expected_exit_code)
     # Killing again should fail silently.
     executive.kill_all(never_ending_command()[0])
开发者ID:Andersbakken,项目名称:check-coding-style,代码行数:16,代码来源:executive_unittest.py


示例16: __init__

 def __init__(self, filesystem=None, webkit_finder=None):
     self.filesystem = filesystem or FileSystem()
     self.executive = Executive()
     self.finder = Finder(self.filesystem)
     self.printer = Printer(sys.stderr)
     self.webkit_finder = webkit_finder or WebKitFinder(self.filesystem)
     self._options = None
开发者ID:coinpayee,项目名称:blink,代码行数:7,代码来源:main.py


示例17: test_default_configuration__standalone

    def test_default_configuration__standalone(self):
        # FIXME: This test runs a standalone python script to test
        # reading the default configuration to work around any possible
        # caching / reset bugs. See https://bugs.webkit.org/show_bug.cgi?id=49360
        # for the motivation. We can remove this test when we remove the
        # global configuration cache in config.py.
        e = Executive()
        fs = FileSystem()
        c = config.Config(e, fs)
        script = WebKitFinder(fs).path_from_webkit_base('Tools', 'Scripts', 'webkitpy', 'layout_tests', 'port', 'config_standalone.py')

        # Note: don't use 'Release' here, since that's the normal default.
        expected = 'Debug'

        args = [sys.executable, script, '--mock', expected]
        actual = e.run_command(args).rstrip()
        self.assertEqual(actual, expected)
开发者ID:kcomkar,项目名称:webkit,代码行数:17,代码来源:config_unittest.py


示例18: script_shell_command

 def script_shell_command(cls, script_name):
     script_path = cls.script_path(script_name)
     # Win32 does not support shebang. We need to detect the interpreter ourself.
     if sys.platform == 'win32':
         interpreter = Executive.interpreter_for_script(script_path)
         if interpreter:
             return [interpreter, script_path]
     return [script_path]
开发者ID:0x4d52,项目名称:JavaScriptCore-X,代码行数:8,代码来源:ports.py


示例19: test_run_command_with_unicode

    def test_run_command_with_unicode(self):
        """Validate that it is safe to pass unicode() objects
        to Executive.run* methods, and they will return unicode()
        objects by default unless decode_output=False"""
        executive = Executive()
        unicode_tor = u"WebKit \u2661 Tor Arne Vestb\u00F8!"
        utf8_tor = unicode_tor.encode("utf-8")

        output = executive.run_command(["cat"], input=unicode_tor)
        self.assertEquals(output, unicode_tor)

        output = executive.run_command(["echo", "-n", unicode_tor])
        self.assertEquals(output, unicode_tor)

        output = executive.run_command(["echo", "-n", unicode_tor], decode_output=False)
        self.assertEquals(output, utf8_tor)

        # Make sure that str() input also works.
        output = executive.run_command(["cat"], input=utf8_tor, decode_output=False)
        self.assertEquals(output, utf8_tor)

        # FIXME: We should only have one run* method to test
        output = executive.run_and_throw_if_fail(["echo", "-n", unicode_tor], quiet=True)
        self.assertEquals(output, unicode_tor)

        output = executive.run_and_throw_if_fail(["echo", "-n", unicode_tor], quiet=True, decode_output=False)
        self.assertEquals(output, utf8_tor)
开发者ID:,项目名称:,代码行数:27,代码来源:


示例20: test_default_configuration__standalone

    def test_default_configuration__standalone(self):
        # FIXME: This test runs a standalone python script to test
        # reading the default configuration to work around any possible
        # caching / reset bugs. See https://bugs.webkit.org/show_bug.cgi?id=49360
        # for the motivation. We can remove this test when we remove the
        # global configuration cache in config.py.
        e = Executive()
        fs = FileSystem()
        c = config.Config(e, fs)
        script = c.path_from_webkit_base("Tools", "Scripts", "webkitpy", "layout_tests", "port", "config_standalone.py")

        # Note: don't use 'Release' here, since that's the normal default.
        expected = "Debug"

        # FIXME: Why are we running a python subprocess here??
        args = [sys.executable, script, "--mock", expected]
        actual = e.run_command(args).rstrip()
        self.assertEqual(actual, expected)
开发者ID:sukwon0709,项目名称:Artemis,代码行数:18,代码来源:config_unittest.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python executive.ScriptError类代码示例发布时间:2022-05-26
下一篇:
Python executive.run_command函数代码示例发布时间: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