Example #1
0
 def pem(env):
     to = env.timeout(2)
     subscribe_at(to)
     try:
         yield env.timeout(10)
     except Interrupt as interrupt:
         assert interrupt.cause == (to, None)
         assert env.now == 2
Example #2
0
 def pem(env):
     to = env.timeout(2)
     subscribe_at(to)
     try:
         yield env.timeout(10)
     except Interrupt as interrupt:
         assert interrupt.cause == (to, None)
         assert env.now == 2
Example #3
0
 def pem(env):
     val = 'ohai'
     to = env.timeout(2, value=val)
     subscribe_at(to)
     try:
         yield env.timeout(10)
     except Interrupt as interrupt:
         assert interrupt.cause == (to, val)
         assert env.now == 2
Example #4
0
 def pem(env):
     val = 'ohai'
     to = env.timeout(2, value=val)
     subscribe_at(to)
     try:
         yield env.timeout(10)
     except Interrupt as interrupt:
         assert interrupt.cause == (to, val)
         assert env.now == 2
Example #5
0
 def parent(env):
     child_proc1 = env.process(child(env, 1))
     child_proc2 = env.process(child(env, 2))
     try:
         subscribe_at(child_proc1)
         yield child_proc2
     except Interrupt as interrupt:
         assert env.now == 1
         assert interrupt.cause[0] is child_proc1
         assert child_proc2.is_alive
Example #6
0
    def parent(env):
        child_proc = env.process(child(env))
        subscribe_at(child_proc)

        try:
            yield env.event()
        except Interrupt as interrupt:
            assert interrupt.cause[0] is child_proc
            assert interrupt.cause[1] == 'ohai'
            assert env.now == 3
Example #7
0
 def parent(env):
     child_proc1 = env.process(child(env, 1))
     child_proc2 = env.process(child(env, 2))
     try:
         subscribe_at(child_proc1)
         yield child_proc2
     except Interrupt as interrupt:
         assert env.now == 1
         assert interrupt.cause[0] is child_proc1
         assert child_proc2.is_alive
Example #8
0
    def parent(env):
        child_proc = env.process(child(env))
        subscribe_at(child_proc)

        try:
            yield env.event()
        except Interrupt as interrupt:
            assert interrupt.cause[0] is child_proc
            assert interrupt.cause[1] == 'ohai'
            assert env.now == 3