You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test.test_zoneinfo.test_zoneinfo.ExtensionBuiltTest.test_cache_location fails if _zoneinfo Cextension isn't built #120965
I was doing some testing to check that Python without optional C extensions remains functional, and I've noticed that the following test fails if _zoneinfo is not built:
======================================================================
FAIL: test_cache_location (test.test_zoneinfo.test_zoneinfo.ExtensionBuiltTest.test_cache_location)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mgorny/git/cpython/Lib/test/test_zoneinfo/test_zoneinfo.py", line 1931, in test_cache_locationself.assertFalse(hasattr(c_zoneinfo.ZoneInfo, "_weak_cache"))
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError: True is not false
FWICS the zoneinfo module tests unconditionally assume that zoneinfoimported with no "blocked" modules. While most of the time, this shouldn't matter, I suppose it would be cleaner to haveget_modules()returnNoneasc_moduleif_zoneinfo` is not importable.
I can try making a PR for this if you agree with this approach (and skipping the duplicate-then C extension tests).
Activity
mgorny commentedon Jun 24, 2024
For the record, my reproducer (in git repo):
gh-120965: Skip `test_zoneinfo.ExtensionBuiltTest` if C extension is …
StanFromIreland commentedon Oct 23, 2026
Thanks for the report, and sorry for the delay but this is fixed now.
[3.14] gh-120965: Skip `test_zoneinfo.ExtensionBuiltTest` if C extens…
[3.15] gh-120965: Skip `test_zoneinfo.ExtensionBuiltTest` if C extens…