Skip to content

Commit 6e5ccd8

Browse files
Backport PR #59893 (CI/TST: Check for tzset in set_timezone) (#59941)
Co-authored-by: Matthew Roeschke <[email protected]>
1 parent 24510bd commit 6e5ccd8

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

pandas/_testing/contexts.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,15 @@ def set_timezone(tz: str) -> Generator[None, None, None]:
7878
import time
7979

8080
def setTZ(tz) -> None:
81-
if tz is None:
82-
try:
83-
del os.environ["TZ"]
84-
except KeyError:
85-
pass
86-
else:
87-
os.environ["TZ"] = tz
88-
time.tzset()
81+
if hasattr(time, "tzset"):
82+
if tz is None:
83+
try:
84+
del os.environ["TZ"]
85+
except KeyError:
86+
pass
87+
else:
88+
os.environ["TZ"] = tz
89+
time.tzset()
8990

9091
orig_tz = os.environ.get("TZ")
9192
setTZ(tz)

pandas/tests/tslibs/test_parsing.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from pandas._libs.tslibs.parsing import parse_datetime_string_with_reso
1818
from pandas.compat import (
1919
ISMUSL,
20+
is_platform_arm,
2021
is_platform_windows,
2122
)
2223
import pandas.util._test_decorators as td
@@ -26,7 +27,7 @@
2627

2728

2829
@pytest.mark.skipif(
29-
is_platform_windows() or ISMUSL,
30+
is_platform_windows() or ISMUSL or is_platform_arm(),
3031
reason="TZ setting incorrect on Windows and MUSL Linux",
3132
)
3233
def test_parsing_tzlocal_deprecated():

0 commit comments

Comments
 (0)