Skip to content

Commit f500e4e

Browse files
authored
gh-149879: Fix test_strptime on Cygwin (#150438)
Skip my_MM and or_IN locales on multiple tests, since the tests fail on Cygwin.
1 parent bc67dad commit f500e4e

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Lib/test/test_strptime.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
else:
2020
glibc_ver = None
2121

22+
def skip_cygwin_locale():
23+
if sys.platform != 'cygwin':
24+
return
25+
loc = locale.getlocale(locale.LC_TIME)[0]
26+
if loc in ('my_MM', 'or_IN'):
27+
raise unittest.SkipTest('test fails on Cygwin')
28+
2229

2330
class getlang_Tests(unittest.TestCase):
2431
"""Test _getlang"""
@@ -509,6 +516,8 @@ def test_bad_timezone(self):
509516
'my_MM', 'or_IN', 'shn_MM', 'az_IR',
510517
'byn_ER', 'wal_ET', 'lzh_TW')
511518
def test_date_time_locale(self):
519+
skip_cygwin_locale()
520+
512521
# Test %c directive
513522
loc = locale.getlocale(locale.LC_TIME)[0]
514523
if glibc_ver and glibc_ver < (2, 31) and loc == 'br_FR':
@@ -536,6 +545,8 @@ def test_date_time_locale(self):
536545
'csb_PL', 'br_FR', 'gez_ET', 'brx_IN',
537546
'my_MM', 'shn_MM')
538547
def test_date_time_locale2(self):
548+
skip_cygwin_locale()
549+
539550
# Test %c directive
540551
loc = locale.getlocale(locale.LC_TIME)[0]
541552
if sys.platform.startswith('sunos'):
@@ -550,6 +561,8 @@ def test_date_time_locale2(self):
550561
'he_IL', 'eu_ES', 'ar_AE',
551562
'az_IR', 'my_MM', 'or_IN', 'shn_MM', 'lzh_TW')
552563
def test_date_locale(self):
564+
skip_cygwin_locale()
565+
553566
# Test %x directive
554567
now = time.time()
555568
self.roundtrip('%x', slice(0, 3), time.localtime(now))
@@ -567,6 +580,8 @@ def test_date_locale(self):
567580
@run_with_locales('LC_TIME', 'en_US', 'fr_FR', 'de_DE', 'ja_JP',
568581
'eu_ES', 'ar_AE', 'my_MM', 'shn_MM', 'lzh_TW')
569582
def test_date_locale2(self):
583+
skip_cygwin_locale()
584+
570585
# Test %x directive
571586
loc = locale.getlocale(locale.LC_TIME)[0]
572587
if sys.platform.startswith(('sunos', 'aix')):
@@ -587,6 +602,8 @@ def test_date_locale2(self):
587602
'ti_ET', 'tig_ER', 'wal_ET', 'lzh_TW',
588603
'ar_SA', 'bg_BG')
589604
def test_time_locale(self):
605+
skip_cygwin_locale()
606+
590607
# Test %X directive
591608
loc = locale.getlocale(locale.LC_TIME)[0]
592609
pos = slice(3, 6)

0 commit comments

Comments
 (0)