def METHOD_NAME(sqlalchemy_psycopg2_connector_factory, exception):
    connector = sqlalchemy_psycopg2_connector_factory()
    with pytest.raises(exception):
        with connector.engine.begin():
            raise exception