]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
test: fix test of pipeline mode and nested transaction
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 9 May 2022 22:57:16 +0000 (00:57 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 9 May 2022 22:57:16 +0000 (00:57 +0200)
This test fails in the current implementation.

tests/test_pipeline.py
tests/test_pipeline_async.py

index 7049e77c0afd6103cc97c92de1b29d21f62f9382..b62e1653898e6feb34f8b40a4c2de23de005819c 100644 (file)
@@ -248,12 +248,12 @@ def test_errors_raised_on_transaction_exit(conn):
 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")
 
index ea0a074a623f3eb1df29d3a87f44713e20223b59..234cc5edce17a7615e7795fbb96a38bcc4e9944f 100644 (file)
@@ -251,12 +251,12 @@ async def test_errors_raised_on_transaction_exit(aconn):
 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")