FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-102537: Handle check for PYTHONTZPATH failing in zoneinfo test by pganssle · Pull Request #102538 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
9 changes: 8 additions & 1 deletion Lib/test/test_zoneinfo/test_zoneinfo.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1543,13 +1543,20 @@ class TzPathTest(TzPathUserMixin, ZoneInfoTestBase):
@contextlib.contextmanager
def python_tzpath_context(value):
path_var = "PYTHONTZPATH"
unset_env_sentinel = object()
old_env = unset_env_sentinel
try:
with OS_ENV_LOCK:
old_env = os.environ.get(path_var, None)
os.environ[path_var] = value
yield
finally:
if old_env is None:
if old_env is unset_env_sentinel:
# In this case, `old_env` was never retrieved from the
# environment for whatever reason, so there's no need to
# reset the environment TZPATH.
pass
elif old_env is None:
del os.environ[path_var]
else:
os.environ[path_var] = old_env # pragma: nocover
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Adjust the error handling strategy in
``test_zoneinfo.TzPathTest.python_tzpath_context``. Patch by Paul Ganssle.

Back | FazBrowse Home | New Git URL