add some state-machine tracing
needs warner/automat/36-tracing branch
This commit is contained in:
parent
97d1ff859b
commit
c8be988801
|
@ -10,6 +10,8 @@ from . import _interfaces
|
||||||
class Mailbox(object):
|
class Mailbox(object):
|
||||||
_side = attrib(validator=instance_of(type(u"")))
|
_side = attrib(validator=instance_of(type(u"")))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
|
@m.setTrace()
|
||||||
|
def setTrace(): pass
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._mood = None
|
self._mood = None
|
||||||
|
|
|
@ -40,6 +40,9 @@ class New(ServerBase, unittest.TestCase):
|
||||||
@inlineCallbacks
|
@inlineCallbacks
|
||||||
def test_basic(self):
|
def test_basic(self):
|
||||||
w1 = wormhole.deferred_wormhole(APPID, self.relayurl, reactor)
|
w1 = wormhole.deferred_wormhole(APPID, self.relayurl, reactor)
|
||||||
|
def trace(old_state, input, new_state):
|
||||||
|
print("W1._M[%s].%s -> [%s]" % (old_state, input, new_state))
|
||||||
|
w1._boss._M.setTrace(trace)
|
||||||
w1.allocate_code(2)
|
w1.allocate_code(2)
|
||||||
code = yield w1.when_code()
|
code = yield w1.when_code()
|
||||||
print("code:", code)
|
print("code:", code)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user