From 2226d0692d5f7ff35490d7ead6d54e1c3da63819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20G=C3=A4bler?= <34601603+dg98@users.noreply.github.com> Date: Sun, 9 Mar 2025 14:55:47 +0100 Subject: [PATCH] Fix flaky test in translation tests (#1298) Signed-off-by: Dennis Gaebler --- test/test_apprise_translations.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test_apprise_translations.py b/test/test_apprise_translations.py index a339175a..546b74e1 100644 --- a/test/test_apprise_translations.py +++ b/test/test_apprise_translations.py @@ -297,6 +297,9 @@ def test_apprise_trans_windows_users_nux(mock_getlocale): # 4105 = en_CA windll.kernel32.GetUserDefaultUILanguage.return_value = 4105 + # Store default value to not break other tests + default_language = locale.AppriseLocale._default_language + with environ('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG'): # Our default language locale.AppriseLocale._default_language = 'zz' @@ -325,6 +328,9 @@ def test_apprise_trans_windows_users_nux(mock_getlocale): delattr(ctypes, 'windll') + # Restore default value + locale.AppriseLocale._default_language = default_language + @pytest.mark.skipif(sys.platform == "win32", reason="Unique Nux test cases") @mock.patch('locale.getlocale')