From 5d2e5f9329327cd39f5273db4afaaeb69b9f3430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Thu, 16 May 2024 21:19:17 +0200 Subject: [PATCH] Use the catch_warnings context manager when importing relatorio Using warnings.resetwarnings also reset the warnings filter set from the environment variable which makes working on fixing warnings more difficult. --- trytond/trytond/report/report.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trytond/trytond/report/report.py b/trytond/trytond/report/report.py index 79e783dfed..8795ec2e19 100644 --- a/trytond/trytond/report/report.py +++ b/trytond/trytond/report/report.py @@ -48,10 +48,10 @@ try: except ImportError: qrcode = None -warnings.simplefilter("ignore") -import relatorio.reporting # noqa: E402 +with warnings.catch_warnings(): + warnings.simplefilter("ignore") + import relatorio.reporting # noqa: E402 -warnings.resetwarnings() try: from relatorio.templates.opendocument import MANIFEST, Manifest except ImportError: