本文整理匯總了Python中st2common.runners.paramiko_ssh.ParamikoSSHClient.CHUNK_SIZE方法的典型用法代碼示例。如果您正苦於以下問題:Python ParamikoSSHClient.CHUNK_SIZE方法的具體用法?Python ParamikoSSHClient.CHUNK_SIZE怎麽用?Python ParamikoSSHClient.CHUNK_SIZE使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類st2common.runners.paramiko_ssh.ParamikoSSHClient
的用法示例。
在下文中一共展示了ParamikoSSHClient.CHUNK_SIZE方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_consume_stderr
# 需要導入模塊: from st2common.runners.paramiko_ssh import ParamikoSSHClient [as 別名]
# 或者: from st2common.runners.paramiko_ssh.ParamikoSSHClient import CHUNK_SIZE [as 別名]
def test_consume_stderr(self):
# Test utf-8 decoding of ``stderr`` still works fine when reading CHUNK_SIZE splits a
# multi-byte utf-8 character in the middle. We should wait to collect all bytes
# and finally decode.
conn_params = {'hostname': 'dummy.host.org',
'username': 'ubuntu'}
mock = ParamikoSSHClient(**conn_params)
mock.CHUNK_SIZE = 1
chan = Mock()
chan.recv_stderr_ready.side_effect = [True, True, True, True, False]
chan.recv_stderr.side_effect = ['\xF0', '\x90', '\x8D', '\x88']
try:
'\xF0'.decode('utf-8')
self.fail('Test fixture is not right.')
except UnicodeDecodeError:
pass
stderr = mock._consume_stderr(chan)
self.assertEqual(u'\U00010348', stderr.getvalue())