예제 #1
0
def read(in_q, out_q):
    t_id = current_thread().ident
    countries = View('country').read()
    while True:
        in_q.get()
        in_q.task_done()
        c = countries.one()
        if c is None:
            break
        out_q.put((t_id, c[0]))
예제 #2
0
def test_nested_read(session):
    # Needed because table creation and content is not committed yet
    ctx.connection.commit()

    # Start read from parent ctx
    cursor = View('country').read()
    first = cursor.one()

    # We re-use the current config to create a nested context
    with connect(ctx.cfg):
        nested_res = View('country').read().all()

    res = [first] + list(cursor)
    assert res == nested_res