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

Python unittest.fail函数代码示例

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

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



在下文中一共展示了fail函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:andrewbird,项目名称:vodafone-mobile-connect,代码行数:7,代码来源:test_ssh.py


示例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
开发者ID:williamsjj,项目名称:twisted,代码行数:10,代码来源:test_ssh.py


示例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
开发者ID:williamsjj,项目名称:twisted,代码行数:14,代码来源:test_ssh.py


示例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
开发者ID:galaxysd,项目名称:BitTorrent,代码行数:32,代码来源:test_conch.py


示例5: _ebRequestFailed

 def _ebRequestFailed(self, reason):
     unittest.fail('max packet exec failed: %s' % reason)
开发者ID:williamsjj,项目名称:twisted,代码行数:2,代码来源:test_ssh.py


示例6: openFailed

 def openFailed(self, reason):
     unittest.fail('max packet open failed: %s' % reason)
开发者ID:williamsjj,项目名称:twisted,代码行数:2,代码来源:test_ssh.py


示例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()
开发者ID:andrewbird,项目名称:vodafone-mobile-connect,代码行数:6,代码来源:test_ssh.py


示例8: receiveUnimplemented

 def receiveUnimplemented(self, seqID):
     unittest.fail('got unimplemented: seqid %s'  % seqID)
     self.expectedLoseConnection = 1
     self.loseConnection()
开发者ID:williamsjj,项目名称:twisted,代码行数:4,代码来源:test_ssh.py


示例9: _ebRealRequestFailed

 def _ebRealRequestFailed(self, reason):
     unittest.fail('opening crazy subsystem failed: %s' % reason)
开发者ID:williamsjj,项目名称:twisted,代码行数:2,代码来源:test_ssh.py


示例10: _ebPtyReq

 def _ebPtyReq(self, reason):
     unittest.fail('pty request failed: %s' % reason)
开发者ID:williamsjj,项目名称:twisted,代码行数:2,代码来源:test_ssh.py


示例11: dataReceived

 def dataReceived(self, data):
     unittest.fail('got data when using false')
开发者ID:williamsjj,项目名称:twisted,代码行数:2,代码来源:test_ssh.py


示例12: _cbRequestWorked

 def _cbRequestWorked(self, ignored):
     unittest.fail('fail exec succeeded')
开发者ID:williamsjj,项目名称:twisted,代码行数:2,代码来源:test_ssh.py


示例13: channelOpen

 def channelOpen(self, ignored):
     unittest.fail("opened unknown channel")
开发者ID:williamsjj,项目名称:twisted,代码行数:2,代码来源:test_ssh.py


示例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)
开发者ID:williamsjj,项目名称:twisted,代码行数:4,代码来源:test_ssh.py


示例15: errReceived

 def errReceived(self, dataType, data):
     unittest.fail('echo channel got extended data')
开发者ID:williamsjj,项目名称:twisted,代码行数:2,代码来源:test_ssh.py


示例16: _ebSecondGlobal

 def _ebSecondGlobal(self, reason):
     unittest.fail('second global request failed: %s' % reason)
开发者ID:williamsjj,项目名称:twisted,代码行数:2,代码来源:test_ssh.py


示例17: _ebShellOpen

 def _ebShellOpen(self, reason):
     unittest.fail('shell request failed: %s' % reason)
开发者ID:williamsjj,项目名称:twisted,代码行数:2,代码来源:test_ssh.py


示例18: _ebFirstGlobal

 def _ebFirstGlobal(self, reason):
     unittest.fail('first global request failed: %s' % reason)
开发者ID:williamsjj,项目名称:twisted,代码行数:2,代码来源:test_ssh.py


示例19: connectionLost

 def connectionLost(self, reason):
     if self.done:
         return
     if not hasattr(self,'expectedLoseConnection'):
         unittest.fail('unexpectedly lost connection %s\n%s' % (self, reason))
     self.done = 1
开发者ID:williamsjj,项目名称:twisted,代码行数:6,代码来源:test_ssh.py


示例20: _cbThirdGlobal

 def _cbThirdGlobal(self, ignored):
     unittest.fail('second global request succeeded')
开发者ID:williamsjj,项目名称:twisted,代码行数:2,代码来源:test_ssh.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python unittest.main函数代码示例发布时间:2022-05-27
下一篇:
Python unittest.decorate函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap