]> granicus.if.org Git - postgresql/commitdiff
Tweak tests to support Python 3.7
authorPeter Eisentraut <peter_e@gmx.net>
Tue, 13 Feb 2018 21:13:20 +0000 (16:13 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Thu, 3 May 2018 17:13:09 +0000 (13:13 -0400)
Python 3.7 removes the trailing comma in the repr() of
BaseException (see <https://bugs.python.org/issue30399>), leading to
test output differences.  Work around that by composing the equivalent
test output in a more manual way.

src/pl/plpython/expected/plpython_subtransaction.out
src/pl/plpython/sql/plpython_subtransaction.sql

index da3b312a06b3463fdc67e50983e61015e10de64b..b38cde8d2dbeebd38a4177f8b964c8e8391b025e 100644 (file)
@@ -134,7 +134,7 @@ with plpy.subtransaction():
     except plpy.SPIError, e:
         if not swallow:
             raise
-        plpy.notice("Swallowed %r" % e)
+        plpy.notice("Swallowed %s(%r)" % (e.__class__.__name__, e.args[0]))
 return "ok"
 $$ LANGUAGE plpythonu;
 SELECT subtransaction_nested_test();
@@ -153,7 +153,7 @@ SELECT * FROM subtransaction_tbl;
 
 TRUNCATE subtransaction_tbl;
 SELECT subtransaction_nested_test('t');
-NOTICE:  Swallowed SyntaxError('syntax error at or near "error"',)
+NOTICE:  Swallowed SyntaxError('syntax error at or near "error"')
  subtransaction_nested_test 
 ----------------------------
  ok
@@ -178,7 +178,7 @@ with plpy.subtransaction():
 return "ok"
 $$ LANGUAGE plpythonu;
 SELECT subtransaction_deeply_nested_test();
-NOTICE:  Swallowed SyntaxError('syntax error at or near "error"',)
+NOTICE:  Swallowed SyntaxError('syntax error at or near "error"')
  subtransaction_deeply_nested_test 
 -----------------------------------
  ok
index 3c188e3dd2dc2b1ea8cb1cf1cbf1745edcda53a7..398c65720ced41349550356f6e1fb115d104d998 100644 (file)
@@ -80,7 +80,7 @@ with plpy.subtransaction():
     except plpy.SPIError, e:
         if not swallow:
             raise
-        plpy.notice("Swallowed %r" % e)
+        plpy.notice("Swallowed %s(%r)" % (e.__class__.__name__, e.args[0]))
 return "ok"
 $$ LANGUAGE plpythonu;