Ejemplo n.º 1
0
def test_connection_stacking(redis, loop):
    """Connection stacking."""

    conn1 = yield from find_connection(loop)
    conn2 = yield from find_connection(loop)

    with (yield from Connection(conn1)):
        q1 = Queue()
        with (yield from Connection(conn2)):
            q2 = Queue()

    assert q1.connection != q2.connection
    assert q1.connection == conn1
    assert q2.connection == conn2
Ejemplo n.º 2
0
def test_use_connection_explicit_redis(redis, loop):
    """Pass redis connection explicitly."""

    connection = yield from find_connection(loop)
    yield from use_connection(redis=connection)
    assert get_current_connection() == connection
    push_connection(redis)      # Make test finalizer happy.