Exemplo n.º 1
0
def test_rpcfuture_cancellation():
    rpc_fut = RPCFuture()
    fut = Future()

    rpc_fut.attach(fut)

    rpc_fut.cancel()

    assert fut.cancelled()
Exemplo n.º 2
0
def test_propagates_only_once_1():
    rpc_fut = RPCFuture()
    fut = Future()

    rpc_fut.attach(fut)
    rpc_fut.cancel()
    rpc_fut.set_result(42)

    with pytest.raises(CancelledError):
        assert fut.result(timeout=1)