mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-137976: Explicitly exclude localtime from available_timezones (#138012)
* fix: available_timezones is reporting an invalid IANA zone name * 📜🤖 Added by blurb_it. * correct rst format for backticks --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
This commit is contained in:
parent
d641c41c88
commit
0f27e10204
4 changed files with 21 additions and 1 deletions
|
|
@ -349,7 +349,7 @@ Functions
|
||||||
|
|
||||||
This function only includes canonical zone names and does not include
|
This function only includes canonical zone names and does not include
|
||||||
"special" zones such as those under the ``posix/`` and ``right/``
|
"special" zones such as those under the ``posix/`` and ``right/``
|
||||||
directories, or the ``posixrules`` zone.
|
directories, the ``posixrules`` or the ``localtime`` zone.
|
||||||
|
|
||||||
.. caution::
|
.. caution::
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1951,6 +1951,21 @@ def test_exclude_posixrules(self):
|
||||||
actual = self.module.available_timezones()
|
actual = self.module.available_timezones()
|
||||||
self.assertEqual(actual, expected)
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
|
def test_exclude_localtime(self):
|
||||||
|
expected = {
|
||||||
|
"America/New_York",
|
||||||
|
"Europe/London",
|
||||||
|
}
|
||||||
|
|
||||||
|
tree = list(expected) + ["localtime"]
|
||||||
|
|
||||||
|
with tempfile.TemporaryDirectory() as td:
|
||||||
|
for key in tree:
|
||||||
|
self.touch_zone(key, td)
|
||||||
|
|
||||||
|
with self.tzpath_context([td]):
|
||||||
|
actual = self.module.available_timezones()
|
||||||
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
class CTestModule(TestModule):
|
class CTestModule(TestModule):
|
||||||
module = c_zoneinfo
|
module = c_zoneinfo
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,10 @@ def valid_key(fpath):
|
||||||
# posixrules is a special symlink-only time zone where it exists, it
|
# posixrules is a special symlink-only time zone where it exists, it
|
||||||
# should not be included in the output
|
# should not be included in the output
|
||||||
valid_zones.remove("posixrules")
|
valid_zones.remove("posixrules")
|
||||||
|
if "localtime" in valid_zones:
|
||||||
|
# localtime is a special symlink-only time zone where it exists, it
|
||||||
|
# should not be included in the output
|
||||||
|
valid_zones.remove("localtime")
|
||||||
|
|
||||||
return valid_zones
|
return valid_zones
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Removed ``localtime`` from the list of reported system timezones.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue