本文整理汇总了Python中twisted.trial.unittest.fail函数的典型用法代码示例。如果您正苦于以下问题:Python fail函数的具体用法?Python fail怎么用?Python fail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: request_exit_status
def request_exit_status(self, status):
status, = struct.unpack('>L', status)
if status == 0:
unittest.fail('false exit status was 0')
log.msg('finished false')
self.conn.addResult()
return 1
示例2: closed
def closed(self):
if self.status != 0:
unittest.fail('err exit status was not 0: %i' % self.status)
if self.testBuf != "hello\r\n":
unittest.fail('err did not return hello: %s' % repr(self.testBuf))
unittest.assertEquals(self.localWindowLeft, 4)
unittest.assert_(self.eofCalled)
log.msg('finished err')
self.conn.addResult()
return 1
示例3: global_tcpip_forward
def global_tcpip_forward(self, data):
host, port = forwarding.unpackGlobal_tcpip_forward(data)
try: listener = reactor.listenTCP(port,
forwarding.SSHListenForwardingFactory(self.conn,
(host, port),
forwarding.SSHListenServerForwardingChannel),
interface = host)
except:
log.err()
unittest.fail("something went wrong with remote->local forwarding")
return 0
else:
self.listeners[(host, port)] = listener
return 1
示例4: execute
def execute(self, args, p, preargs = ''):
if runtime.platformType == 'win32':
raise unittest.SkipTest, "can't run cmdline client on win32"
port = self.server.getHost().port
cmd1 = ('-p %i -l testuser '
'--known-hosts kh_test '
'--user-authentications publickey '
'--host-key-algorithms ssh-rsa '
'-a '
'-K direct '
'-i dsa_test '
'127.0.0.1') % port
cmd2 = ('-p %i -l testuser '
'-K unix '
'-v ') % port + preargs + \
' 127.0.0.1 ' + args
cmds1 = cmd1.split()
cmds2 = _makeArgs(cmd2.split())
o = options.ConchOptions()
def _(host, *args):
o['host'] = host
o.parseArgs = _
o.parseOptions(cmds1)
vhk = default.verifyHostKey
conn = SSHTestConnectionForUnix(p, sys.executable, cmds2)
uao = default.SSHUserAuthClient(o['user'], o, conn)
d = connect.connect(o['host'], int(o['port']), o, vhk, uao)
d.addErrback(lambda f: unittest.fail('Failure connecting to test server: %s' % f))
d.addCallback(lambda x : p.deferred)
d.addCallback(lambda x : defer.maybeDeferred(
conn.transport.transport.loseConnection))
return d
示例5: _ebRequestFailed
def _ebRequestFailed(self, reason):
unittest.fail('max packet exec failed: %s' % reason)
示例6: openFailed
def openFailed(self, reason):
unittest.fail('max packet open failed: %s' % reason)
示例7: receiveError
def receiveError(self, reasonCode, desc):
self.expectedLoseConnection = 1
if not self.allowedToError:
unittest.fail('got disconnect for %s: reason %s, desc: %s' %
(self, reasonCode, desc))
self.loseConnection()
示例8: receiveUnimplemented
def receiveUnimplemented(self, seqID):
unittest.fail('got unimplemented: seqid %s' % seqID)
self.expectedLoseConnection = 1
self.loseConnection()
示例9: _ebRealRequestFailed
def _ebRealRequestFailed(self, reason):
unittest.fail('opening crazy subsystem failed: %s' % reason)
示例10: _ebPtyReq
def _ebPtyReq(self, reason):
unittest.fail('pty request failed: %s' % reason)
示例11: dataReceived
def dataReceived(self, data):
unittest.fail('got data when using false')
示例12: _cbRequestWorked
def _cbRequestWorked(self, ignored):
unittest.fail('fail exec succeeded')
示例13: channelOpen
def channelOpen(self, ignored):
unittest.fail("opened unknown channel")
示例14: ssh_USERAUTH_SUCCESS
def ssh_USERAUTH_SUCCESS(self, packet):
if not self.canSucceedPassword and self.canSucceedPublicKey:
unittest.fail('got USERAUTH_SUCESS before password and publickey')
userauth.SSHUserAuthClient.ssh_USERAUTH_SUCCESS(self, packet)
示例15: errReceived
def errReceived(self, dataType, data):
unittest.fail('echo channel got extended data')