details: https://code.tryton.org/tryton/commit/b7d6bfe71a7f
branch: default
user: Cédric Krier <[email protected]>
date: Tue Jul 07 19:16:08 2026 +0200
description:
Re-raise transaction error from sub-test of button
Since a05fa06b3a4c the test of button is executed under the subTest
context
manager but if the method is raising a TransactionError, it is
considered as a
failure for the test.
But we need this exception to be raised up to the with_transaction
decorator in
order to fix the transaction and execute fully the method of the button.
diffstat:
trytond/trytond/tests/test_tryton.py | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diffs (23 lines):
diff -r c4f986450d75 -r b7d6bfe71a7f trytond/trytond/tests/test_tryton.py
--- a/trytond/trytond/tests/test_tryton.py Wed Jul 08 09:19:35 2026 +0200
+++ b/trytond/trytond/tests/test_tryton.py Tue Jul 07 19:16:08 2026 +0200
@@ -1173,6 +1173,7 @@
if not issubclass(model, ModelView):
continue
for button in model._buttons:
+ transaction_error = None
with self.subTest(model=model.__name__, button=button):
try:
if is_instance_method(model, button):
@@ -1181,6 +1182,11 @@
getattr(model, button)([])
except (UserError, UserWarning):
pass
+ except TransactionError as e:
+ transaction_error = e
+ pass
+ if transaction_error:
+ raise transaction_error
@with_transaction()
def test_xml_files(self):