details:   https://code.tryton.org/tryton/commit/3b3531bafbda
branch:    default
user:      Cédric Krier <[email protected]>
date:      Thu Jan 22 23:15:21 2026 +0100
description:
        Allow the UserError and UserWarning exceptions to be raised when 
testing the buttons

        Closes #14539
diffstat:

 trytond/trytond/tests/test_tryton.py |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 646d50f1e24e -r 3b3531bafbda trytond/trytond/tests/test_tryton.py
--- a/trytond/trytond/tests/test_tryton.py      Wed Jan 28 10:39:07 2026 +0100
+++ b/trytond/trytond/tests/test_tryton.py      Thu Jan 22 23:15:21 2026 +0100
@@ -29,6 +29,7 @@
 
 from trytond import backend, config
 from trytond.cache import Cache
+from trytond.exceptions import UserError, UserWarning
 from trytond.model import (
     ModelSingleton, ModelSQL, ModelStorage, ModelView, Workflow, fields)
 from trytond.model.fields import Function
@@ -1147,10 +1148,13 @@
             if not issubclass(model, ModelView):
                 continue
             for button in model._buttons:
-                if is_instance_method(model, button):
-                    getattr(model(), button)()
-                else:
-                    getattr(model, button)([])
+                try:
+                    if is_instance_method(model, button):
+                        getattr(model(), button)()
+                    else:
+                        getattr(model, button)([])
+                except (UserError, UserWarning):
+                    pass
 
     @with_transaction()
     def test_xml_files(self):

Reply via email to