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

Function test_set_transaction_param_reset

tests/test_connection.py:731–749  ·  view source on GitHub ↗
(conn, param)

Source from the content-addressed store, hash-verified

729
730@pytest.mark.parametrize("param", tx_params_isolation)
731def test_set_transaction_param_reset(conn, param):
732 conn.execute(
733 "select set_config(%s, %s, false)",
734 [f"default_transaction_{param.guc}", param.non_default],
735 )
736 conn.commit()
737
738 for value in param.values:
739 getattr(conn, f"set_{param.name}")(value)
740 cur = conn.execute("select current_setting(%s)", [f"transaction_{param.guc}"])
741 (pgval,) = cur.fetchone()
742 assert tx_values_map[pgval] == value
743 conn.rollback()
744
745 getattr(conn, f"set_{param.name}")(None)
746 cur = conn.execute("select current_setting(%s)", [f"transaction_{param.guc}"])
747 (pgval,) = cur.fetchone()
748 assert tx_values_map[pgval] == tx_values_map[param.non_default]
749 conn.rollback()
750
751
752@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