From: Daniele Varrazzo Date: Mon, 9 May 2022 21:46:47 +0000 (+0200) Subject: test: drop TODO points and emergency rollbacks from pipeline tests X-Git-Tag: 3.1~113^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7a36e0de07b804ae886b0cc60d43c8c79f4c647;p=thirdparty%2Fpsycopg.git test: drop TODO points and emergency rollbacks from pipeline tests 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. --- diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index 29816cf23..7049e77c0 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -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") diff --git a/tests/test_pipeline_async.py b/tests/test_pipeline_async.py index b3dfef755..ea0a074a6 100644 --- a/tests/test_pipeline_async.py +++ b/tests/test_pipeline_async.py @@ -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")