Exemple #1
0
 def inner():
     reactor = Reactor()
     reactor.start(f)
     if callable(expected_result):
         assert expected_result(reactor.result), repr(reactor.result)
     else:
         assert reactor.result == expected_result, "%r <> %r" % (reactor.result, expected_result)
Exemple #2
0
def test_stop():
    def sleeper(reactor):
        reactor.sleep(10.0)

    def run(reactor):
        reactor.spawn(sleeper, (reactor,))
        reactor.stop()

    reactor = Reactor()
    start = time.time()
    reactor.start(run)
    stop = time.time()

    assert round(stop - start, 1) == 0.0