From b365ec3e0c75fae878cb273f1ac3713f382586b8 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Sat, 19 Aug 2023 23:50:16 -0400 Subject: [PATCH] py3.10 testfix --- test/test_locale.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/test_locale.py b/test/test_locale.py index f2436620a4..64fada89f1 100644 --- a/test/test_locale.py +++ b/test/test_locale.py @@ -144,6 +144,7 @@ def test_detect_language_windows_users(): if hasattr(ctypes, 'windll'): from ctypes import windll + else: windll = mock.Mock() # 4105 = en_CA @@ -166,8 +167,7 @@ def test_detect_language_windows_users(): def test_detect_language_using_env(): """ - When enabling CI testing on Windows, those tests did not produce the - correct results. They may want to be reviewed. + Test the reading of information from an environment variable """ # The below accesses the windows fallback code and fail @@ -194,7 +194,6 @@ def test_detect_language_using_env(): assert isinstance(AppriseLocale.AppriseLocale.detect_language(), str) -@pytest.mark.skipif(sys.platform == "win32", reason="Does not work on Windows") @mock.patch('locale.getlocale') def test_detect_language_locale(mock_getlocale): """ @@ -203,7 +202,8 @@ def test_detect_language_locale(mock_getlocale): """ # Handle case where getlocale() can't be detected mock_getlocale.return_value = None - assert AppriseLocale.AppriseLocale.detect_language() is None + with environ('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG'): + assert AppriseLocale.AppriseLocale.detect_language() is None # if detect_language and windows env fail us, then we don't # set up a default language on first load