8000 PL/Python: Fix tests for older Python versions · postgrespro/postgres@f498704 · GitHub
[go: up one dir, main page]

Skip to content
  • Commit f498704

    Browse files
    committed
    PL/Python: Fix tests for older Python versions
    Commit 8561e48 neglected to handle older Python versions that don't support the "with" statement. So write the tests in a way that older versions can handle as well.
    1 parent 2b792ab commit f498704
    < 8000 span class="CopyToClipboardButton-module__tooltip--Dq1IB prc-TooltipV2-Tooltip-cYMVY" data-direction="sw" aria-label="Copy full SHA for f498704" aria-hidden="true" id=":R4lebab:">Copy full SHA for f498704

    File tree

    2 files changed

    +6
    -4
    lines changed

    2 files changed

    +6
    -4
    lines changed

    src/pl/plpython/expected/plpython_transaction.out

    Lines changed: 3 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -95,8 +95,9 @@ CONTEXT: Traceback (most recent call last):
    9595
    PL/Python function "transaction_test4"
    9696
    -- commit inside subtransaction (prohibited)
    9797
    DO LANGUAGE plpythonu $$
    98-
    with plpy.subtransaction():
    99-
    plpy.commit()
    98+
    s = plpy.subtransaction()
    99+
    s.enter()
    100+
    plpy.commit()
    100101
    $$;
    101102
    WARNING: forcibly aborting a subtransaction that has not been exited
    102103
    ERROR: cannot commit while a subtransaction is active

    src/pl/plpython/sql/plpython_transaction.sql

    Lines changed: 3 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -79,8 +79,9 @@ SELECT transaction_test4();
    7979

    8080
    -- commit inside subtransaction (prohibited)
    8181
    DO LANGUAGE plpythonu $$
    82-
    with plpy.subtransaction():
    83-
    plpy.commit()
    82+
    s = plpy.subtransaction()
    83+
    s.enter()
    84+
    plpy.commit()
    8485
    $$;
    8586

    8687

    0 commit comments

    Comments
     (0)
    0