本文整理汇总了Python中twisted.internet.reactor.crash函数的典型用法代码示例。如果您正苦于以下问题:Python crash函数的具体用法?Python crash怎么用?Python crash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了crash函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gotOutput
def gotOutput(self, node, sender, data):
global success
if self.expected.get(node) == None:
self.expected[node] = 0
if (self.expected.get(node, int(data)) != int(data)):
print "Got " + data.rstrip() + " instead of " + \
str(self.expected[node]) + " from " + node.name
success = False
reactor.crash()
if not sender in node.peers:
print "Sender " + sender + " not in node peers"
success = False
reactor.crash()
self.expected[node] = int(data) + 1
if self.expected[node] == 10:
self.done += 1
if self.done == NUMNODES - 1:
for x in self.nodes:
x.stats()
self.nodes[-1].disconnect()
示例2: gotOutput
def gotOutput(self, node, sender, data):
global success
if sender == "retriever":
return
if self.expected.get(node) == None:
self.expected[node] = 0
if (self.expected.get(node, int(data)) != int(data)):
print "Got " + data.rstrip() + " instead of " + \
str(self.expected[node]) + " from " + node.name
success = False
reactor.crash()
if not sender in node.peers:
print "Sender " + sender + " not in node peers"
success = False
reactor.crash()
self.expected[node] = int(data) + 1
if self.expected[node] == 10:
self.done += 1
开发者ID:freedesktop-unofficial-mirror,项目名称:telepathy__telepathy-salut,代码行数:25,代码来源:repair-after-node-disconnected-test.py
示例3: OnTimeout
def OnTimeout( self ):
"""On a timeout condition, raise an error"""
if not self.finished:
self.finished = 1
self.result = defer.TimeoutError('SNMP request timed out')
self.success = 0
reactor.crash()
示例4: receiveError
def receiveError(self, reasonCode, desc):
global theTest
reactor.crash()
self.expectedLoseConnection = 1
if not self.allowedToError:
theTest.fail('got disconnect for %s: reason %s, desc: %s' %
(self, reasonCode, desc))
示例5: _failTest
def _failTest():
fac.proto.transport.loseConnection()
cfac.client.transport.loseConnection()
reactor.iterate(0.1)
reactor.iterate(0.1)
reactor.iterate(0.1)
reactor.crash()
self.fail('test took too long')
示例6: getChannel
def getChannel(self, ct, ws, mp, d):
if ct != 'session':
global theTest
theTest.fail('should not get %s as a channel type' % ct)
reactor.crash()
return SSHTestServerSession(remoteWindow = ws,
remoteMaxPacket = mp,
conn = self)
示例7: results_received
def results_received(results):
global external_command
external_command.shutdown()
# Give threads time to finish
sleep(0.05)
if not results == ('foo', 'bar'):
exit(1)
reactor.crash()
示例8: command_received
def command_received(self, clm, cmd):
try:
self.file_out.write(cmd + '\n')
self.file_out.flush()
except:
self.rval = 1
reactor.crash()
return
示例9: subtest_done
def subtest_done(self, subtest):
self.nsubtests_running -= 1
if subtest.rval == 0:
self.rval -= 1
if self.nsubtests_running == 0:
if self.rval == 1:
self.rval = 0
reactor.crash()
示例10: exec_test_deferred
def exec_test_deferred (funs, params, protocol=None, timeout=None):
colourer = None
if sys.stdout.isatty():
colourer = install_colourer()
queue = servicetest.IteratingEventQueue(timeout)
queue.verbose = (
os.environ.get('CHECK_TWISTED_VERBOSE', '') != ''
or '-v' in sys.argv)
bus = dbus.SessionBus()
sim = Simulator()
bus.add_signal_receiver(
lambda *args, **kw:
queue.append(
Event('dbus-signal',
path=unwrap(kw['path']),
signal=kw['member'], args=map(unwrap, args),
interface=kw['interface'])),
None, # signal name
None, # interface
None,
path_keyword='path',
member_keyword='member',
interface_keyword='interface',
byte_arrays=True
)
try:
for f in funs:
conn = make_connection(bus, queue.append, params)
f(queue, bus, conn)
except Exception:
import traceback
traceback.print_exc()
try:
if colourer:
sys.stdout = colourer.fh
reactor.crash()
# force Disconnect in case the test crashed and didn't disconnect
# properly. We need to call this async because the BaseIRCServer
# class must do something in response to the Disconnect call and if we
# call it synchronously, we're blocking ourself from responding to the
# quit method.
servicetest.call_async(queue, conn, 'Disconnect')
if 'RING_TEST_REFDBG' in os.environ:
# we have to wait for the timeout so the process is properly
# exited and refdbg can generate its report
time.sleep(5.5)
except dbus.DBusException:
pass
示例11: buildProtocol
def buildProtocol(self, addr):
if hasattr(self, 'proto'):
global theTest
reactor.crash()
theTest.fail('connected twice to factory')
self.proto = SSHTestServer()
self.proto.supportedPublicKeys = self.privateKeys.keys()
self.proto.factory = self
return self.proto
示例12: timedOut
def timedOut(self):
"""I'm called when the safety timer expires indicating test probably won't complete"""
# FIXME: how do we cancel this test and cleanup remaining deferreds?
self.pending_deferreds = []
if debug:
"**** timedOut callback, test did not complete"
self.fail("Safety timeout callback ... test did not complete")
reactor.crash()
示例13: stop
def stop(ignored=None, connector=None):
if isinstance(ignored, Exception):
raise ignored
if reactor.running:
if getattr(reactor, 'threadpool', None) is not None:
reactor.threadpool.stop()
reactor.threadpool = None
reactor.crash()
if connector:
connector.disconnect()
示例14: gotReply
def gotReply(reply):
if reply != [b"REP: REQ1"]:
print("Unexpected reply: %r" % (reply, ))
global exitCode
exitCode = 1
reactor.crash()
return
print("OK")
reactor.crash()
示例15: got_result
def got_result(self, result):
if self.fout != None:
try:
self.fout.write("%s\n" % result)
self.fout.flush()
except:
self.rval = 1
reactor.crash()
return
self.responses.append(result)
self.issue_next_cmd()