https://github.com/python/cpython/commit/f500e4e351afa24d13cb75e88eb90c1bd6667d9f
commit: f500e4e351afa24d13cb75e88eb90c1bd6667d9f
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-05-26T04:25:07+02:00
summary:

gh-149879: Fix test_strptime on Cygwin (#150438)

Skip my_MM and or_IN locales on multiple tests, since the tests fail
on Cygwin.

files:
M Lib/test/test_strptime.py

diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py
index 5ac28870455f4d..e95cc6db170e24 100644
--- a/Lib/test/test_strptime.py
+++ b/Lib/test/test_strptime.py
@@ -19,6 +19,13 @@
 else:
     glibc_ver = None
 
+def skip_cygwin_locale():
+    if sys.platform != 'cygwin':
+        return
+    loc = locale.getlocale(locale.LC_TIME)[0]
+    if loc in ('my_MM', 'or_IN'):
+        raise unittest.SkipTest('test fails on Cygwin')
+
 
 class getlang_Tests(unittest.TestCase):
     """Test _getlang"""
@@ -509,6 +516,8 @@ def test_bad_timezone(self):
                       'my_MM', 'or_IN', 'shn_MM', 'az_IR',
                       'byn_ER', 'wal_ET', 'lzh_TW')
     def test_date_time_locale(self):
+        skip_cygwin_locale()
+
         # Test %c directive
         loc = locale.getlocale(locale.LC_TIME)[0]
         if glibc_ver and glibc_ver < (2, 31) and loc == 'br_FR':
@@ -536,6 +545,8 @@ def test_date_time_locale(self):
                       'csb_PL', 'br_FR', 'gez_ET', 'brx_IN',
                       'my_MM', 'shn_MM')
     def test_date_time_locale2(self):
+        skip_cygwin_locale()
+
         # Test %c directive
         loc = locale.getlocale(locale.LC_TIME)[0]
         if sys.platform.startswith('sunos'):
@@ -550,6 +561,8 @@ def test_date_time_locale2(self):
                       'he_IL', 'eu_ES', 'ar_AE',
                       'az_IR', 'my_MM', 'or_IN', 'shn_MM', 'lzh_TW')
     def test_date_locale(self):
+        skip_cygwin_locale()
+
         # Test %x directive
         now = time.time()
         self.roundtrip('%x', slice(0, 3), time.localtime(now))
@@ -567,6 +580,8 @@ def test_date_locale(self):
     @run_with_locales('LC_TIME', 'en_US', 'fr_FR', 'de_DE', 'ja_JP',
                       'eu_ES', 'ar_AE', 'my_MM', 'shn_MM', 'lzh_TW')
     def test_date_locale2(self):
+        skip_cygwin_locale()
+
         # Test %x directive
         loc = locale.getlocale(locale.LC_TIME)[0]
         if sys.platform.startswith(('sunos', 'aix')):
@@ -587,6 +602,8 @@ def test_date_locale2(self):
                       'ti_ET', 'tig_ER', 'wal_ET', 'lzh_TW',
                       'ar_SA', 'bg_BG')
     def test_time_locale(self):
+        skip_cygwin_locale()
+
         # Test %X directive
         loc = locale.getlocale(locale.LC_TIME)[0]
         pos = slice(3, 6)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to