Skip to content

Commit 36a7f11

Browse files
AlenkaFjorisvandenbossche
authored andcommitted
ARROW-16233: [Python] [Packaging] test_zoneinfo_tzinfo_to_string fails with zoneinfo._common.ZoneInfoNotFoundError on packaging wheels on Windows
Trying to fix failing nightly-packaging jobs for windows wheels: - [wheel-windows-cp310-amd64](https://github.com/ursacomputing/crossbow/tree/nightly-packaging-2022-04-18-0-github-wheel-windows-cp310-amd64) - [wheel-windows-cp39-amd64](https://github.com/ursacomputing/crossbow/tree/nightly-packaging-2022-04-18-0-github-wheel-windows-cp39-amd64) Closes #12930 from AlenkaF/ARROW-16233 Authored-by: Alenka Frim <frim.alenka@gmail.com> Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
1 parent 1dccb56 commit 36a7f11

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

python/pyarrow/tests/strategies.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# under the License.
1717

1818
import datetime
19+
import sys
1920

2021
import pytest
2122
import hypothesis as h
@@ -29,6 +30,11 @@
2930
import zoneinfo
3031
except ImportError:
3132
zoneinfo = None
33+
if sys.platform == 'win32':
34+
try:
35+
import tzdata # noqa:F401
36+
except ImportError:
37+
zoneinfo = None
3238
import numpy as np
3339

3440
import pyarrow as pa
@@ -103,6 +109,7 @@
103109
pa.time64('us'),
104110
pa.time64('ns')
105111
])
112+
106113
if tzst and zoneinfo:
107114
timezones = st.one_of(st.none(), tzst.timezones(), st.timezones())
108115
elif tzst:
@@ -277,7 +284,7 @@ def arrays(draw, type, size=None, nullable=True):
277284
value = st.dates()
278285
elif pa.types.is_timestamp(ty):
279286
if zoneinfo is None:
280-
pytest.skip('no module named zoneinfo')
287+
pytest.skip('no module named zoneinfo (or tzdata on Windows)')
281288
if ty.tz is None:
282289
pytest.skip('requires timezone not None')
283290
min_int64 = -(2**63)

python/pyarrow/tests/test_types.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ def test_dateutil_tzinfo_to_string():
325325

326326
def test_zoneinfo_tzinfo_to_string():
327327
zoneinfo = pytest.importorskip('zoneinfo')
328+
if sys.platform == 'win32':
329+
# zoneinfo requires an additional dependency On Windows
330+
# tzdata provides IANA time zone data
331+
pytest.importorskip('tzdata')
328332

329333
tz = zoneinfo.ZoneInfo('UTC')
330334
assert pa.lib.tzinfo_to_string(tz) == 'UTC'

python/requirements-wheel-test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pickle5; platform_system != "Windows" and python_version < "3.8"
55
pytest
66
pytest-lazy-fixture
77
pytz
8+
tzdata; sys_platform == 'win32'
89

910
numpy==1.19.5; platform_system == "Linux" and platform_machine == "aarch64" and python_version < "3.7"
1011
numpy==1.21.3; platform_system == "Linux" and platform_machine == "aarch64" and python_version >= "3.7"

0 commit comments

Comments
 (0)