]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
test: drop TODO points and emergency rollbacks from pipeline tests
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 9 May 2022 21:46:47 +0000 (23:46 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 9 May 2022 21:46:47 +0000 (23:46 +0200)
The previous changeset restored some sanity. The behaviour in
`test_errors_raised_on_commit` is not inconsistent with the non-pipeline
mode because the two are not comparable: in non-pipeline mode the
exception is raised by `execute()`, not by `commit()`. If an exception
is raised in `commit()` itself, it is already handled consistently, as
`test_error_on_commit` shows.

tests/test_pipeline.py
tests/test_pipeline_async.py

index 29816cf23f4c667eaa79a66483b68a118e686c5e..7049e77c0afd6103cc97c92de1b29d21f62f9382 100644 (file)
@@ -222,7 +222,7 @@ def test_errors_raised_on_commit(conn):
         conn.execute("select 1 from nosuchtable")
         with pytest.raises(e.UndefinedTable):
             conn.commit()
-        conn.rollback()  # TODO: inconsistent with non-pipeline.
+        conn.rollback()
         cur1 = conn.execute("select 1")
     cur2 = conn.execute("select 2")
 
@@ -253,7 +253,6 @@ def test_errors_raised_on_nested_transaction_exit(conn):
                 with conn.transaction():
                     conn.execute("select 1 from nosuchtable")
                     here = True
-        conn.rollback()  # TODO: inconsistent with non-pipeline.
         cur1 = conn.execute("select 1")
     assert here
     cur2 = conn.execute("select 2")
index b3dfef755ae16712dccf7824dbb3ecffd9db7f18..ea0a074a623f3eb1df29d3a87f44713e20223b59 100644 (file)
@@ -225,7 +225,7 @@ async def test_errors_raised_on_commit(aconn):
         await aconn.execute("select 1 from nosuchtable")
         with pytest.raises(e.UndefinedTable):
             await aconn.commit()
-        await aconn.rollback()  # TODO: inconsistent with non-pipeline.
+        await aconn.rollback()
         cur1 = await aconn.execute("select 1")
     cur2 = await aconn.execute("select 2")
 
@@ -256,7 +256,6 @@ async def test_errors_raised_on_nested_transaction_exit(aconn):
                 async with aconn.transaction():
                     await aconn.execute("select 1 from nosuchtable")
                     here = True
-        await aconn.rollback()  # TODO: inconsistent with non-pipeline.
         cur1 = await aconn.execute("select 1")
     assert here
     cur2 = await aconn.execute("select 2")