Skip to content

gh-149879: Fix test_strptime on Cygwin - #150438

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:test_strptime
May 26, 2026
Merged

gh-149879: Fix test_strptime on Cygwin#150438
vstinner merged 1 commit into
python:mainfrom
vstinner:test_strptime

Conversation

@vstinner

@vstinnervstinner commented May 26, 2026

Copy link
Copy Markdown
Member

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

Skip my_MM and or_IN locales on multiple tests, since the tests fail
on Cygwin.
@bedevere-appbedevere-appBot added the tests Tests in the Lib/test dir label May 26, 2026
@bedevere-appbedevere-appBot mentioned this pull request May 26, 2026
@vstinner

Copy link
Copy Markdown
MemberAuthor

Cygwin uses the newlib C library. Multiple test_strptime tests with my_MM and or_IN locales.

Details
======================================================================
ERROR: test_date_locale (test.test_strptime.StrptimeTests.test_date_locale) (locale='my_MM')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vstinner/cpython/Lib/test/support/__init__.py", line 1156, in wrapper
func(self, *args, **kwargs)
~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/test/test_strptime.py", line 555, in test_date_locale
self.roundtrip('%x', slice(0, 3), time.localtime(now))
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/test/test_strptime.py", line 304, in roundtrip
strp_output = _strptime._strptime_time(strf_output, fmt)
File "/home/vstinner/cpython/Lib/_strptime.py", line 812, in _strptime_time
tt = _strptime(data_string, format)[0]
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/_strptime.py", line 574, in _strptime
raise ValueError("time data %r does not match format %r" %
(data_string, format))
ValueError: time data '20၂၆ မေ ၂၆ အင်္ဂါ' does not match format '%x'
======================================================================
ERROR: test_date_locale (test.test_strptime.StrptimeTests.test_date_locale) (locale='or_IN')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vstinner/cpython/Lib/test/support/__init__.py", line 1156, in wrapper
func(self, *args, **kwargs)
~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/test/test_strptime.py", line 555, in test_date_locale
self.roundtrip('%x', slice(0, 3), time.localtime(now))
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/test/test_strptime.py", line 304, in roundtrip
strp_output = _strptime._strptime_time(strf_output, fmt)
File "/home/vstinner/cpython/Lib/_strptime.py", line 812, in _strptime_time
tt = _strptime(data_string, format)[0]
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/_strptime.py", line 574, in _strptime
raise ValueError("time data %r does not match format %r" %
(data_string, format))
ValueError: time data '୨୬-୫-୨୬' does not match format '%x'
======================================================================
ERROR: test_date_locale2 (test.test_strptime.StrptimeTests.test_date_locale2) (locale='my_MM')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vstinner/cpython/Lib/test/support/__init__.py", line 1156, in wrapper
func(self, *args, **kwargs)
~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/test/test_strptime.py", line 575, in test_date_locale2
self.roundtrip('%x', slice(0, 3), (1900, 1, 1, 0, 0, 0, 0, 1, 0))
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/test/test_strptime.py", line 304, in roundtrip
strp_output = _strptime._strptime_time(strf_output, fmt)
File "/home/vstinner/cpython/Lib/_strptime.py", line 812, in _strptime_time
tt = _strptime(data_string, format)[0]
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/_strptime.py", line 574, in _strptime
raise ValueError("time data %r does not match format %r" %
(data_string, format))
ValueError: time data '19၀၀ ဇန် ၀၀၀၁ တနင်္လာ' does not match format '%x'
======================================================================
ERROR: test_date_time_locale (test.test_strptime.StrptimeTests.test_date_time_locale) (locale='my_MM')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vstinner/cpython/Lib/test/support/__init__.py", line 1156, in wrapper
func(self, *args, **kwargs)
~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/test/test_strptime.py", line 517, in test_date_time_locale
self.roundtrip('%c', slice(0, 6), time.localtime(now))
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/test/test_strptime.py", line 304, in roundtrip
strp_output = _strptime._strptime_time(strf_output, fmt)
File "/home/vstinner/cpython/Lib/_strptime.py", line 812, in _strptime_time
tt = _strptime(data_string, format)[0]
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/_strptime.py", line 574, in _strptime
raise ValueError("time data %r does not match format %r" %
(data_string, format))
ValueError: time data '20၂၆ မေ ၂၆ အင်္ဂါ ၀၁:၄၈:၀၁ နံနက်' does not match format '%c'
======================================================================
ERROR: test_date_time_locale (test.test_strptime.StrptimeTests.test_date_time_locale) (locale='or_IN')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vstinner/cpython/Lib/test/support/__init__.py", line 1156, in wrapper
func(self, *args, **kwargs)
~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/test/test_strptime.py", line 517, in test_date_time_locale
self.roundtrip('%c', slice(0, 6), time.localtime(now))
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/test/test_strptime.py", line 304, in roundtrip
strp_output = _strptime._strptime_time(strf_output, fmt)
File "/home/vstinner/cpython/Lib/_strptime.py", line 812, in _strptime_time
tt = _strptime(data_string, format)[0]
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/_strptime.py", line 574, in _strptime
raise ValueError("time data %r does not match format %r" %
(data_string, format))
ValueError: time data '୨୬ ମେ ୨୬ ୧:୪୮:୧ AM' does not match format '%c'
======================================================================
ERROR: test_date_time_locale2 (test.test_strptime.StrptimeTests.test_date_time_locale2) (locale='my_MM')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vstinner/cpython/Lib/test/support/__init__.py", line 1156, in wrapper
func(self, *args, **kwargs)
~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/test/test_strptime.py", line 544, in test_date_time_locale2
self.roundtrip('%c', slice(0, 6), (1900, 1, 1, 0, 0, 0, 0, 1, 0))
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/test/test_strptime.py", line 304, in roundtrip
strp_output = _strptime._strptime_time(strf_output, fmt)
File "/home/vstinner/cpython/Lib/_strptime.py", line 812, in _strptime_time
tt = _strptime(data_string, format)[0]
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/_strptime.py", line 574, in _strptime
raise ValueError("time data %r does not match format %r" %
(data_string, format))
ValueError: time data '19၀၀ ဇန် ၀၀၀၁ တနင်္လာ ၁၂:၀၀:၀၀ နံနက်' does not match format '%c'
======================================================================
ERROR: test_time_locale (test.test_strptime.StrptimeTests.test_time_locale) (locale='or_IN')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vstinner/cpython/Lib/test/support/__init__.py", line 1156, in wrapper
func(self, *args, **kwargs)
~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/test/test_strptime.py", line 600, in test_time_locale
self.roundtrip('%X', pos, time.localtime(now))
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/test/test_strptime.py", line 304, in roundtrip
strp_output = _strptime._strptime_time(strf_output, fmt)
File "/home/vstinner/cpython/Lib/_strptime.py", line 812, in _strptime_time
tt = _strptime(data_string, format)[0]
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/cpython/Lib/_strptime.py", line 574, in _strptime
raise ValueError("time data %r does not match format %r" %
(data_string, format))
ValueError: time data '୧:୪୮:୧ AM' does not match format '%X'
----------------------------------------------------------------------
Ran 60 tests in 1.686s
FAILED (errors=7, skipped=19)

@vstinner

Copy link
Copy Markdown
MemberAuthor

"Tests / Sanitizers / UBSan" failed, but the failure is unrelated to this change.

0:03:01 load avg: 8.06 mem: 128.1 MiB [ 69/503/1] test.test_multiprocessing_fork.test_processes failed (1 error) (43.9 sec) -- running (1): test.test_multiprocessing_forkserver.test_manager (30.9 sec)
Warning -- Dangling processes: {<Process name='Process-152' pid=22369 parent=20628 started daemon>}
Warning -- Dangling processes: {<Process name='Process-152' pid=22369 parent=20628 started daemon>}
test test.test_multiprocessing_fork.test_processes failed -- Traceback (most recent call last):
File "/home/runner/work/cpython/cpython/Lib/contextlib.py", line 116, in inner
return func(*args, **kwds)
File "/home/runner/work/cpython/cpython/Lib/test/_test_multiprocessing.py", line 649, in test_interrupt
exitcode = self._kill_process(multiprocessing.Process.interrupt)
File "/home/runner/work/cpython/cpython/Lib/contextlib.py", line 116, in inner
return func(*args, **kwds)
File "/home/runner/work/cpython/cpython/Lib/test/_test_multiprocessing.py", line 630, in _kill_process
self.assertEqual(join(), None)
~~~~^^
File "/home/runner/work/cpython/cpython/Lib/test/_test_multiprocessing.py", line 303, in __call__
return self.func(*args, **kwds)
~~~~~~~~~^^^^^^^^^^^^^^^
File "/home/runner/work/cpython/cpython/Lib/multiprocessing/process.py", line 156, in join
res = self._popen.wait(timeout)
File "/home/runner/work/cpython/cpython/Lib/multiprocessing/popen_fork.py", line 44, in wait
return self.poll(os.WNOHANG if timeout == 0.0 else 0)
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/cpython/cpython/Lib/multiprocessing/popen_fork.py", line 28, in poll
pid, sts = os.waitpid(self.pid, flag)
~~~~~~~~~~^^^^^^^^^^^^^^^^
File "/home/runner/work/cpython/cpython/Lib/test/_test_multiprocessing.py", line 626, in handler
raise RuntimeError('join took too long: %s' % p)
RuntimeError: join took too long: <Process name='Process-152' pid=22369 parent=20628 started daemon>

@vstinner
vstinner merged commit f500e4e into python:mainMay 26, 2026
95 of 97 checks passed
@vstinner
vstinner deleted the test_strptime branch May 26, 2026 02:25
@StanFromIreland

Copy link
Copy Markdown
Member

Oh, I would have liked a solution that covers some more platforms, since I know Solaris has similar issues with its system libraries.

@vstinner

Copy link
Copy Markdown
MemberAuthor

The skip_cygwin_locale() function can be renamed to skip_broken_locale() and adapted to skip other locales on other platforms.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@vstinner@StanFromIreland