Skip to content

Commit

Permalink
Use fixed timezone. Simplify Solaris tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka committed Oct 21, 2024
1 parent 6c4220a commit a8b2e9d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions Lib/test/test_strptime.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,23 +515,19 @@ def test_date_time_locale(self):

# NB: Dates before 1969 do not roundtrip on some locales:
# az_IR, bo_CN, bo_IN, dz_BT, eu_ES, eu_FR, fa_IR, or_IN.
@support.run_with_tz('STD-1DST,M4.1.0,M10.1.0')
@run_with_locales('LC_TIME', 'C', 'en_US', 'fr_FR', 'de_DE', 'ja_JP',
'he_IL', 'ar_AE', 'mfe_MU', 'yo_NG',
'csb_PL', 'br_FR', 'gez_ET', 'brx_IN',
'my_MM', 'shn_MM')
def test_date_time_locale2(self):
# Test %c directive
loc = locale.getlocale(locale.LC_TIME)[0]
if sys.platform.startswith(('sunos', 'solaris')):
if sys.platform.startswith('sunos'):
if loc in ('ar_AE',):
self.skipTest(f'locale {loc!r} may not work on this platform')
self.roundtrip('%c', slice(0, 6), (1900, 1, 1, 0, 0, 0, 0, 1, 0))
try:
self.roundtrip('%c', slice(0, 6), (1800, 1, 1, 0, 0, 0, 0, 1, 0))
except ValueError:
if 'LMT' in time.strftime('%c', (1800, 1, 1, 0, 0, 0, 0, 1, 0)):
self.skipTest('different timezone in the past is not supported')
raise
self.roundtrip('%c', slice(0, 6), (1800, 1, 1, 0, 0, 0, 0, 1, 0))

# NB: Does not roundtrip because use non-Gregorian calendar:
# lo_LA, thai, th_TH. On Windows: ar_IN, ar_SA, fa_IR, ps_AF.
Expand Down Expand Up @@ -563,7 +559,7 @@ def test_date_locale(self):
def test_date_locale2(self):
# Test %x directive
loc = locale.getlocale(locale.LC_TIME)[0]
if sys.platform.startswith(('sunos', 'solaris')):
if sys.platform.startswith('sunos'):
if loc in ('en_US', 'de_DE', 'ar_AE'):
self.skipTest(f'locale {loc!r} may not work on this platform')
self.roundtrip('%x', slice(0, 3), (1900, 1, 1, 0, 0, 0, 0, 1, 0))
Expand Down

0 comments on commit a8b2e9d

Please sign in to comment.