From 71ecacf5ab5e7583f9aa503e2c442f4af9239632 Mon Sep 17 00:00:00 2001 From: "V. Armando Sole" Date: Wed, 11 Oct 2023 10:28:03 +0200 Subject: [PATCH] Make sure restoring the current locale cannot give an error. --- PyMca5/tests/SpecfileTest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PyMca5/tests/SpecfileTest.py b/PyMca5/tests/SpecfileTest.py index 57192420c..d11a09ca6 100644 --- a/PyMca5/tests/SpecfileTest.py +++ b/PyMca5/tests/SpecfileTest.py @@ -93,7 +93,11 @@ def tearDown(self): # this should free the handle gc.collect() # restore saved locale - locale.setlocale(locale.LC_ALL, current_locale) + try: + locale.setlocale(locale.LC_ALL, current_locale) + except locale.Error: + # this should not happen + print(f"Error trying to restore locale <{current_locale}>") if self.specfileClass is not None: if os.path.exists(self.fname):