Repository navigation
Python 3.13.1 test_datetime failures #129483
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jan 30, 2025 I ended up running ./python -mtest -v test_datetime and got the results listed below.
Looks like the test_vilnius_1949_* tests fail with something date formatting related. I suspect I have to configure a locale somewhere. I'll keep looking====================================================================== FAIL: test_vilnius_1941_fromutc (test.datetimetester.TestLocalTimeDisambiguation_Pure.test_vilnius_1941_fromutc) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/karel/Python-3.13.1/Lib/test/datetimetester.py", line 5808, in test_vilnius_1941_fromutc self.assertEqual(ldt.strftime("%c %Z%z"), ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^ 'Mon Jun 23 23:59:59 1941 MSK+0300') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: 'Mon 23 Jun 1941 23:59:59 CET MSK+0300' != 'Mon Jun 23 23:59:59 1941 MSK+0300' - Mon 23 Jun 1941 23:59:59 CET MSK+0300 ? --- ^^^^ ^^^ + Mon Jun 23 23:59:59 1941 MSK+0300 ? ^^ ^^^^ ====================================================================== FAIL: test_vilnius_1941_toutc (test.datetimetester.TestLocalTimeDisambiguation_Pure.test_vilnius_1941_toutc) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/karel/Python-3.13.1/Lib/test/datetimetester.py", line 5832, in test_vilnius_1941_toutc self.assertEqual(gdt.strftime("%c %Z"), ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^ 'Mon Jun 23 19:59:59 1941 UTC') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: 'Mon 23 Jun 1941 19:59:59 UTC' != 'Mon Jun 23 19:59:59 1941 UTC' - Mon 23 Jun 1941 19:59:59 UTC ? --- ^^^^ + Mon Jun 23 19:59:59 1941 UTC ? ^^ ++++ ====================================================================== FAIL: test_vilnius_1941_fromutc (test.datetimetester.TestLocalTimeDisambiguation_Fast.test_vilnius_1941_fromutc) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/karel/Python-3.13.1/Lib/test/datetimetester.py", line 5808, in test_vilnius_1941_fromutc self.assertEqual(ldt.strftime("%c %Z%z"), ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^ 'Mon Jun 23 23:59:59 1941 MSK+0300') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: 'Mon 23 Jun 1941 23:59:59 CET MSK+0300' != 'Mon Jun 23 23:59:59 1941 MSK+0300' - Mon 23 Jun 1941 23:59:59 CET MSK+0300 ? --- ^^^^ ^^^ + Mon Jun 23 23:59:59 1941 MSK+0300 ? ^^ ^^^^ ====================================================================== FAIL: test_vilnius_1941_toutc (test.datetimetester.TestLocalTimeDisambiguation_Fast.test_vilnius_1941_toutc) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/karel/Python-3.13.1/Lib/test/datetimetester.py", line 5832, in test_vilnius_1941_toutc self.assertEqual(gdt.strftime("%c %Z"), ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^ 'Mon Jun 23 19:59:59 1941 UTC') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: 'Mon 23 Jun 1941 19:59:59 UTC' != 'Mon Jun 23 19:59:59 1941 UTC' - Mon 23 Jun 1941 19:59:59 UTC ? --- ^^^^ + Mon Jun 23 19:59:59 1941 UTC ? ^^ ++++ ---------------------------------------------------------------------- Ran 1036 tests in 4.967s FAILED (failures=4, skipped=31) test test_datetime failed test_datetime failed (4 failures) == Tests result: FAILURE == 1 test failed: test_datetime Total duration: 5.1 sec Total tests: run=1,036 failures=4 skipped=31 Total test files: run=1/1 failed=1 Result: FAILURE karel@homeassistant:~/Python-3.13.1 $Fixed by setting my locale to 'C'. It was set to en_GB.UTF-8
Command used to fix it:export LC_ALL=CI feel like either I missed an instruction or it would be an improvement to the documentation if it's not there.
Let me know and I'll send a PR to add it to README.rst (or somewhere else if you prefer somewhere else)Reacted by dx2ztm76-new and Kir ChouHit this issue today.
I am not sure if we should fix this under Makefile while I think we can program this with locale (and it's more reasonable to do this way unless we expect LC_ALL=C to always be the case). Added a PR.
I cannot reproduce this issue on Fedora 43:
$ LC_ALL=en_GB.UTF-8 make test TESTOPTS="-v test_datetime" (...) Result: SUCCESSpythoninfo:
$ ./python -m test.pythoninfo|grep -E 'libc|CC.version|uname|platform\.|os.environ' CC.version: gcc (GCC) 15.2.1 20251111 (Red Hat 15.2.1-4) os.environ[DISPLAY]: :0 os.environ[HOME]: /home/vstinner os.environ[LANG]: fr_FR.UTF-8 os.environ[MAKEFLAGS]: -j14 os.environ[PATH]: /home/vstinner/.local/bin:/usr/local/bin:/usr/bin:/home/vstinner/.npm-global/bin os.environ[SHELL]: /bin/bash os.environ[TERM]: xterm-256color os.environ[WAYLAND_DISPLAY]: wayland-0 os.uname: posix.uname_result(sysname='Linux', nodename='mona', release='6.17.7-300.fc43.x86_64', version='#1 SMP PREEMPT_DYNAMIC Sun Nov 2 15:30:09 UTC 2025', machine='x86_64') platform.architecture: 64bit ELF platform.freedesktop_os_release[ID]: fedora platform.freedesktop_os_release[NAME]: Fedora Linux platform.freedesktop_os_release[VARIANT_ID]: workstation platform.freedesktop_os_release[VERSION]: 43 (Workstation Edition) platform.freedesktop_os_release[VERSION_ID]: 43 platform.libc_ver: glibc 2.42 platform.platform: Linux-6.17.7-300.fc43.x86_64-x86_64-with-glibc2.42 platform.python_implementation: CPythonMy environment's
LC_ALLis default to unset.kirchou@kirchou:~$ echo $LC_ALLBased on Victor's comment, maybe
LC_ALL=Cis not the only one to solve this?If that's the case, my first commit may not be the most accurate fix (depends on the original intention of the test)...
I changed this by explicitly changing %c to the exact expected time format.
- added a commit that references this issue
on Dec 4, 2025 Thanks for the bug report, it has been fixed. In the meanwhile, you can use the C locale (ex:
LC_ALL=C).Reacted by Karel Vervaeke- added a commit that references this issue
on Dec 14, 2025
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Bug report
Bug description:
Hi. I'm trying to build from source on a raspberry pi, on a fresh and fully updated debian bookworm install.
test_datetimewas failing so I tried to get more information usingmake test TESTOPTS="-v test_datetime"as suggested by the readme, but that just runs all tests again without additional output for test_datetime (see terminal output pastedbelow.I hope that's enough information. I'll try to look a bit further, this is just where I got the feeling it might not be 100% my own fault anymore ;)
Test output
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
TestLocalTimeDisambiguation's time format locale independent #142193TestLocalTimeDisambiguation's time format locale independent (GH-142193) #142258TestLocalTimeDisambiguation's time format locale independent (GH-142193) #142259