MCPcopy
hub / github.com/psycopg/psycopg / test_set_transaction_param_reset

Function test_set_transaction_param_reset

tests/test_connection_async.py:742–764  ·  view source on GitHub ↗
(aconn, param)

Source from the content-addressed store, hash-verified

740
741@pytest.mark.parametrize("param", tx_params_isolation)
742async def test_set_transaction_param_reset(aconn, param):
743 await aconn.execute(
744 "select set_config(%s, %s, false)",
745 [f"default_transaction_{param.guc}", param.non_default],
746 )
747 await aconn.commit()
748
749 for value in param.values:
750 await getattr(aconn, f"set_{param.name}")(value)
751 cur = await aconn.execute(
752 "select current_setting(%s)", [f"transaction_{param.guc}"]
753 )
754 (pgval,) = await cur.fetchone()
755 assert tx_values_map[pgval] == value
756 await aconn.rollback()
757
758 await getattr(aconn, f"set_{param.name}")(None)
759 cur = await aconn.execute(
760 "select current_setting(%s)", [f"transaction_{param.guc}"]
761 )
762 (pgval,) = await cur.fetchone()
763 assert tx_values_map[pgval] == tx_values_map[param.non_default]
764 await aconn.rollback()
765
766
767@pytest.mark.parametrize("autocommit", [True, False])

Callers

nothing calls this directly

Calls 4

executeMethod · 0.45
commitMethod · 0.45
fetchoneMethod · 0.45
rollbackMethod · 0.45

Tested by

no test coverage detected