本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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
示例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")
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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])