mirror of
https://github.com/postgres/postgres.git
synced 2025-12-12 02:37:31 +03:00
PL/Python: Make tests pass with Python 3.5
The error message wording for AttributeError has changed in Python 3.5. For the plpython_error test, add a new expected file. In the plpython_subtransaction test, we didn't really care what the exception is, only that it is something coming from Python. So use a generic exception instead, which has a message that doesn't vary across versions.
This commit is contained in:
@@ -23,7 +23,7 @@ try:
|
||||
if what_error == "SPI":
|
||||
plpy.execute("INSERT INTO subtransaction_tbl VALUES ('oops')")
|
||||
elif what_error == "Python":
|
||||
plpy.attribute_error
|
||||
raise Exception("Python exception")
|
||||
except:
|
||||
exc = False
|
||||
subxact.__exit__(*sys.exc_info())
|
||||
@@ -53,7 +53,7 @@ with plpy.subtransaction():
|
||||
if what_error == "SPI":
|
||||
plpy.execute("INSERT INTO subtransaction_tbl VALUES ('oops')")
|
||||
elif what_error == "Python":
|
||||
plpy.attribute_error
|
||||
raise Exception("Python exception")
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
SELECT subtransaction_ctx_test();
|
||||
|
||||
Reference in New Issue
Block a user