From 16ca654159eceb4e0122d83713b9b6e388baa97e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 22 Jan 2026 23:15:21 +0100 Subject: [PATCH] Allow the UserError and UserWarning exceptions to be raised when testing the buttons Closes #14539 --- trytond/trytond/tests/test_tryton.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/trytond/trytond/tests/test_tryton.py b/trytond/trytond/tests/test_tryton.py index 6bb8c6aa84..09d7e25fb5 100644 --- a/trytond/trytond/tests/test_tryton.py +++ b/trytond/trytond/tests/test_tryton.py @@ -29,6 +29,7 @@ from werkzeug.test import Client 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 @@ class ModuleTestCase(_DBTestCase): 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):