Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ab7825e

Browse files
committed
Tweak tests to support Python 3.7
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.
1 parent 7ff50cf commit ab7825e

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/pl/plpython/expected/plpython_subtransaction.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ with plpy.subtransaction():
134134
except plpy.SPIError, e:
135135
if not swallow:
136136
raise
137-
plpy.notice("Swallowed %r" % e)
137+
plpy.notice("Swallowed %s(%r)" % (e.__class__.__name__, e.args[0]))
138138
return "ok"
139139
$$ LANGUAGE plpythonu;
140140
SELECT subtransaction_nested_test();
@@ -153,7 +153,7 @@ SELECT * FROM subtransaction_tbl;
153153

154154
TRUNCATE subtransaction_tbl;
155155
SELECT subtransaction_nested_test('t');
156-
NOTICE: Swallowed SyntaxError('syntax error at or near "error"',)
156+
NOTICE: Swallowed SyntaxError('syntax error at or near "error"')
157157
subtransaction_nested_test
158158
----------------------------
159159
ok
@@ -178,7 +178,7 @@ with plpy.subtransaction():
178178
return "ok"
179179
$$ LANGUAGE plpythonu;
180180
SELECT subtransaction_deeply_nested_test();
181-
NOTICE: Swallowed SyntaxError('syntax error at or near "error"',)
181+
NOTICE: Swallowed SyntaxError('syntax error at or near "error"')
182182
subtransaction_deeply_nested_test
183183
-----------------------------------
184184
ok

src/pl/plpython/expected/plpython_subtransaction_0.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ with plpy.subtransaction():
128128
except plpy.SPIError, e:
129129
if not swallow:
130130
raise
131-
plpy.notice("Swallowed %r" % e)
131+
plpy.notice("Swallowed %s(%r)" % (e.__class__.__name__, e.args[0]))
132132
return "ok"
133133
$$ LANGUAGE plpythonu;
134134
ERROR: could not compile PL/Python function "subtransaction_nested_test"

src/pl/plpython/expected/plpython_subtransaction_5.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ with plpy.subtransaction():
128128
except plpy.SPIError, e:
129129
if not swallow:
130130
raise
131-
plpy.notice("Swallowed %r" % e)
131+
plpy.notice("Swallowed %s(%r)" % (e.__class__.__name__, e.args[0]))
132132
return "ok"
133133
$$ LANGUAGE plpythonu;
134134
ERROR: could not compile PL/Python function "subtransaction_nested_test"

src/pl/plpython/sql/plpython_subtransaction.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ with plpy.subtransaction():
8080
except plpy.SPIError, e:
8181
if not swallow:
8282
raise
83-
plpy.notice("Swallowed %r" % e)
83+
plpy.notice("Swallowed %s(%r)" % (e.__class__.__name__, e.args[0]))
8484
return "ok"
8585
$$ LANGUAGE plpythonu;
8686

0 commit comments

Comments
 (0)