def test_errors_raised_on_nested_transaction_exit(conn):
here = False
with conn.pipeline():
- with pytest.raises(e.UndefinedTable):
- with conn.transaction():
+ with conn.transaction():
+ with pytest.raises(e.UndefinedTable):
with conn.transaction():
conn.execute("select 1 from nosuchtable")
here = True
- cur1 = conn.execute("select 1")
+ cur1 = conn.execute("select 1")
assert here
cur2 = conn.execute("select 2")
async def test_errors_raised_on_nested_transaction_exit(aconn):
here = False
async with aconn.pipeline():
- with pytest.raises(e.UndefinedTable):
- async with aconn.transaction():
+ async with aconn.transaction():
+ with pytest.raises(e.UndefinedTable):
async with aconn.transaction():
await aconn.execute("select 1 from nosuchtable")
here = True
- cur1 = await aconn.execute("select 1")
+ cur1 = await aconn.execute("select 1")
assert here
cur2 = await aconn.execute("select 2")