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


Python executive.Executive类代码示例

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


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


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