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

Python log.flushErrors函数代码示例

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

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



在下文中一共展示了flushErrors函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _flushErrors

 def _flushErrors(self, *types):
     # This bit about log flushing seems to be necessary with twisted < 2.5.
     try:
         self.flushLoggedErrors(*types)
     except AttributeError:
         from twisted.python import log as tlog
         tlog.flushErrors(*types)
开发者ID:offlinehacker,项目名称:flumotion,代码行数:7,代码来源:testsuite.py


示例2: openFailed

 def openFailed(self, reason):
     """
     good .... good
     """
     log.msg('unknown open failed')
     log.flushErrors()
     self.conn.addResult()
开发者ID:andrewbird,项目名称:vodafone-mobile-connect,代码行数:7,代码来源:test_ssh.py


示例3: testRefusedAnonymousClientConnection

    def testRefusedAnonymousClientConnection(self):
        onServerLost = defer.Deferred()
        onClientLost = defer.Deferred()
        self.loopback(sslverify.OpenSSLCertificateOptions(privateKey=self.sKey, certificate=self.sCert, verify=True, caCerts=[self.sCert], requireCertificate=True),
                      sslverify.OpenSSLCertificateOptions(requireCertificate=False),
                      onServerLost=onServerLost,
                      onClientLost=onClientLost)

        d = defer.DeferredList([onClientLost, onServerLost], consumeErrors=True)


        def afterLost(((cSuccess, cResult), (sSuccess, sResult))):

            self.failIf(cSuccess)
            self.failIf(sSuccess)

            # XXX Twisted doesn't report SSL errors as SSL errors, but in the
            # future it will.

            # cResult.trap(SSL.Error)
            # sResult.trap(SSL.Error)

            # Twisted trunk will do the correct thing here, and not log any
            # errors.  Twisted 2.1 will do the wrong thing.  We're flushing
            # errors until the buildbot is updated to a reasonable facsimilie
            # of 2.2.
            log.flushErrors(SSL.Error)
开发者ID:andrewbird,项目名称:vodafone-mobile-connect,代码行数:27,代码来源:test_sslverify.py


示例4: testLink

 def testLink(self):
     linkRes = self._getCmdResult('ln testLink testfile1')
     self.failIf(linkRes)
     lslRes = self._getCmdResult('ls -l testLink')
     log.flushErrors()
     self.failUnless(lslRes.startswith('l'), 'link failed')
     self.failIf(self._getCmdResult('rm testLink'))
开发者ID:andrewbird,项目名称:vodafone-mobile-connect,代码行数:7,代码来源:test_cftp.py


示例5: _ebConnect

 def _ebConnect(self, f):
     # probably because the server wasn't listening in time
     # but who knows, just try again
     log.msg('ERROR CONNECTING TO %s' % self.port)
     log.err(f)
     log.flushErrors()
     reactor.callLater(1, self._connect)
开发者ID:galaxysd,项目名称:BitTorrent,代码行数:7,代码来源:test_conch.py


示例6: testPBFailures

 def testPBFailures(self):
     auth = authorizer.DefaultAuthorizer()
     appl = app.Application("pbfailure", authorizer=auth)
     SimpleService("pbfailure",auth,appl,self).getPerspectiveNamed("guest").makeIdentity("guest")
     p = reactor.listenTCP(0, pb.BrokerFactory(pb.AuthRoot(auth)), interface="127.0.0.1")
     self.n = p.getHost()[2]
     appl.run(save=0)
     log.flushErrors(PoopError, FailError, DieError)
开发者ID:fxia22,项目名称:ASM_xf,代码行数:8,代码来源:test_pbfailure.py


示例7: testErrors

 def testErrors(self):
     for e, ig in [("hello world","hello world"),
                   (KeyError(), KeyError),
                   (failure.Failure(RuntimeError()), RuntimeError)]:
         log.err(e)
         i = self.catcher.pop()
         self.assertEquals(i['isError'], 1)
         log.flushErrors(ig)
开发者ID:andrewbird,项目名称:vodafone-mobile-connect,代码行数:8,代码来源:test_log.py


示例8: testChAttrs

 def testChAttrs(self):
    lsRes = self._getCmdResult('ls -l testfile1')
    self.failUnless(lsRes.startswith('-rw-r--r--'), lsRes)
    self.failIf(self._getCmdResult('chmod 0 testfile1'))
    lsRes = self._getCmdResult('ls -l testfile1')
    self.failUnless(lsRes.startswith('----------'), lsRes)
    self.failIf(self._getCmdResult('chmod 644 testfile1'))
    log.flushErrors()
开发者ID:andrewbird,项目名称:vodafone-mobile-connect,代码行数:8,代码来源:test_cftp.py


示例9: testDeferredStopService

 def testDeferredStopService(self):
     ms = app.MultiService("MultiService")
     self.s1 = StoppingService("testService", 0)
     self.s2 = StoppingService("testService2", 1)
     ms.addService(self.s1)
     ms.addService(self.s2)
     ms.stopService().addCallback(self.woohoo)
     log.flushErrors (StopError)
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:8,代码来源:test_app.py


示例10: testStopServiceNone

 def testStopServiceNone(self):
     """MultiService.stopService returns Deferred when service returns None.
     """
     ms = app.MultiService("MultiService")
     self.s1 = StoppingServiceII("testService")
     ms.addService(self.s1)
     d = ms.stopService()
     d.addCallback(self.cb_nonetest)
     log.flushErrors (StopError)
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:9,代码来源:test_app.py


示例11: tearDown

 def tearDown(self):
     try:
         self.flushLoggedErrors(errors.NotAuthenticatedError)
     except AttributeError:
         tlog.flushErrors(errors.NotAuthenticatedError)
     log._getTheFluLogObserver().clearIgnores()
     d = self.feedServer.shutdown()
     d.addCallback(lambda _: self._bouncer.stop())
     d.addCallback(lambda _: self.assertAdditionalFDsOpen(0, 'tearDown'))
     return d
开发者ID:offlinehacker,项目名称:flumotion,代码行数:10,代码来源:test_component_feed.py


示例12: do_logErrCheck

 def do_logErrCheck(cls):
     if log._keptErrors:
         L = []
         for err in log._keptErrors:
             if isinstance(err, failure.Failure):
                 L.append(err)
             else:
                 L.append(repr(err))
         log.flushErrors()
         raise LoggedErrors(L)
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:10,代码来源:util.py


示例13: testErrors

 def testErrors(self):
     for code, methodName in [(666, "fail"), (666, "deferFail"),
                              (12, "fault"), (23, "noSuchMethod"),
                              (17, "deferFault")]:
         l = []
         d = self.proxy().callRemote(methodName).addErrback(l.append)
         while not l:
             reactor.iterate()
         l[0].trap(xmlrpc.Fault)
         self.assertEquals(l[0].value.faultCode, code)
     log.flushErrors(RuntimeError, ValueError)
开发者ID:fxia22,项目名称:ASM_xf,代码行数:11,代码来源:test_xmlrpc.py


示例14: testRegeneratingIt

 def testRegeneratingIt(self):
     for mod in self.removedModules:
         self.failIf(mod.__name__ in sys.modules, 'Started with %r loaded: %r' % (mod.__name__, sys.path))
     _regeneratePluginCache(['axiom', 'xmantissa'])
     log.flushErrors(ImportError) # This is necessary since there are Axiom
                                  # plugins that depend on Mantissa, so when
                                  # Axiom is installed, Mantissa-dependent
                                  # powerups are, but Mantissa isn't some
                                  # harmless tracebacks are printed.
     for mod in self.removedModules:
         self.failIf(mod.__name__ in sys.modules, 'Loaded %r: %r' % (mod.__name__, sys.path))
开发者ID:bne,项目名称:squeal,代码行数:11,代码来源:test_setuphelper.py


示例15: testBadLogin

 def testBadLogin(self):
     factory = pb.PBClientFactory()
     for username, password in [("nosuchuser", "pass"), ("user", "wrongpass")]:
         d = factory.login(credentials.UsernamePassword(username, password), "BRAINS!")
         c = reactor.connectTCP("127.0.0.1", self.portno, factory)
         p = unittest.deferredError(d)
         self.failUnless(p.check("twisted.cred.error.UnauthorizedLogin"))
         c.disconnect()
         reactor.iterate()
         reactor.iterate()
         reactor.iterate()
     from twisted.cred.error import UnauthorizedLogin
     log.flushErrors(UnauthorizedLogin)
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:13,代码来源:test_pb.py


示例16: cbCompleted

 def cbCompleted(ign):
     """
     Flush the exceptions which the reactor should have logged and make
     sure they're actually there.
     """
     errs = log.flushErrors(BadClientError)
     self.assertEquals(len(errs), 2, "Incorrectly found %d errors, expected 2" % (len(errs),))
开发者ID:galaxysd,项目名称:BitTorrent,代码行数:7,代码来源:test_udp.py


示例17: testBadLogin

 def testBadLogin(self):
     d = defer.succeed(None)
     for username, password in [("nosuchuser", "pass"),
                                ("user", "wrongpass")]:
         d.addCallback(self._testBadLogin_once, username, password)
     d.addBoth(lambda res: log.flushErrors(UnauthorizedLogin))
     return d
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:7,代码来源:test_pb.py


示例18: testBrokenTimer

 def testBrokenTimer(self):
     t = internet.TimerService(1, lambda: 1 / 0)
     t.startService()
     util.spinWhile(lambda :t._loop.running, timeout=30)
     t.stopService()
     self.assertEquals([ZeroDivisionError],
                       [o.value.__class__ for o in log.flushErrors(ZeroDivisionError)])
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:7,代码来源:test_application.py


示例19: testErrors

    def testErrors(self):
        p = TestErrorIdentServer()
        p.makeConnection(StringTransport())
        L = []
        p.sendLine = L.append

        p.exceptionType = ident.IdentError
        p.lineReceived('123, 345')
        self.assertEquals(L[0], '123, 345 : ERROR : UNKNOWN-ERROR')
        
        p.exceptionType = ident.NoUser
        p.lineReceived('432, 210')
        self.assertEquals(L[1], '432, 210 : ERROR : NO-USER')
        
        p.exceptionType = ident.InvalidPort
        p.lineReceived('987, 654')
        self.assertEquals(L[2], '987, 654 : ERROR : INVALID-PORT')
        
        p.exceptionType = ident.HiddenUser
        p.lineReceived('756, 827')
        self.assertEquals(L[3], '756, 827 : ERROR : HIDDEN-USER')
        
        p.exceptionType = NewException
        p.lineReceived('987, 789')
        self.assertEquals(L[4], '987, 789 : ERROR : UNKNOWN-ERROR')
        errs = log.flushErrors(NewException)
        self.assertEquals(len(errs), 1)
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:27,代码来源:test_ident.py


示例20: testFailedRETR

    def testFailedRETR(self):
        try:
            f = protocol.Factory()
            f.noisy = 0
            port = reactor.listenTCP(0, f, interface="127.0.0.1")
            portNum = port.getHost().port
            # This test data derived from a bug report by ranty on #twisted
            responses = ['220 ready, dude (vsFTPd 1.0.0: beat me, break me)',
                         # USER anonymous
                         '331 Please specify the password.',
                         # PASS [email protected]
                         '230 Login successful. Have fun.',
                         # TYPE I
                         '200 Binary it is, then.',
                         # PASV
                         '227 Entering Passive Mode (127,0,0,1,%d,%d)' %
                         (portNum >> 8, portNum & 0xff),
                         # RETR /file/that/doesnt/exist
                         '550 Failed to open file.']
            f.buildProtocol = lambda addr: PrintLines(responses)

            client = ftp.FTPClient(passive=1)
            cc = protocol.ClientCreator(reactor, ftp.FTPClient, passive=1)
            client = wait(cc.connectTCP('127.0.0.1', portNum))
            p = protocol.Protocol()
            d = client.retrieveFile('/file/that/doesnt/exist', p)

            # This callback should not be called
            d.addCallback(lambda r, self=self:
                            self.fail('Callback incorrectly called: %r' % r))
            def p(failure):
                # Yow!  Nested DeferredLists!
                failure.trap(defer.FirstError)
                failure.value.subFailure.trap(defer.FirstError)
                subsubFailure = failure.value.subFailure.value.subFailure
                subsubFailure.trap(ftp.CommandFailed)
                # If we got through all that, we got the right failure.

            d.addErrback(p)

            wait(d)
            log.flushErrors(ftp.FTPError)
        finally:
            d = port.stopListening()
            if d is not None:
                wait(d)
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:46,代码来源:test_ftp.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python log.info函数代码示例发布时间:2022-05-27
下一篇:
Python log.err函数代码示例发布时间: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