From: Daniele Varrazzo Date: Mon, 9 May 2022 22:57:16 +0000 (+0200) Subject: test: fix test of pipeline mode and nested transaction X-Git-Tag: 3.1~113^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea03fd166e0af4c570ee22b89cd0383832fe6aff;p=thirdparty%2Fpsycopg.git test: fix test of pipeline mode and nested transaction This test fails in the current implementation. --- diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index 7049e77c0..b62e16538 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -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") diff --git a/tests/test_pipeline_async.py b/tests/test_pipeline_async.py index ea0a074a6..234cc5edc 100644 --- a/tests/test_pipeline_async.py +++ b/tests/test_pipeline_async.py @@ -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")