Skip to content

Commit

Permalink
ARROW-16233: [Python] [Packaging] test_zoneinfo_tzinfo_to_string fail…
Browse files Browse the repository at this point in the history
…s 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 apache#12930 from AlenkaF/ARROW-16233

Authored-by: Alenka Frim <[email protected]>
Signed-off-by: Joris Van den Bossche <[email protected]>
  • Loading branch information
AlenkaF authored and jorisvandenbossche committed Apr 21, 2022
1 parent 1dccb56 commit 36a7f11
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/pyarrow/tests/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.

import datetime
import sys

import pytest
import hypothesis as h
Expand All @@ -29,6 +30,11 @@
import zoneinfo
except ImportError:
zoneinfo = None
if sys.platform == 'win32':
try:
import tzdata # noqa:F401
except ImportError:
zoneinfo = None
import numpy as np

import pyarrow as pa
Expand Down Expand Up @@ -103,6 +109,7 @@
pa.time64('us'),
pa.time64('ns')
])

if tzst and zoneinfo:
timezones = st.one_of(st.none(), tzst.timezones(), st.timezones())
elif tzst:
Expand Down Expand Up @@ -277,7 +284,7 @@ def arrays(draw, type, size=None, nullable=True):
value = st.dates()
elif pa.types.is_timestamp(ty):
if zoneinfo is None:
pytest.skip('no module named zoneinfo')
pytest.skip('no module named zoneinfo (or tzdata on Windows)')
if ty.tz is None:
pytest.skip('requires timezone not None')
min_int64 = -(2**63)
Expand Down
4 changes: 4 additions & 0 deletions python/pyarrow/tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ def test_dateutil_tzinfo_to_string():

def test_zoneinfo_tzinfo_to_string():
zoneinfo = pytest.importorskip('zoneinfo')
if sys.platform == 'win32':
# zoneinfo requires an additional dependency On Windows
# tzdata provides IANA time zone data
pytest.importorskip('tzdata')

tz = zoneinfo.ZoneInfo('UTC')
assert pa.lib.tzinfo_to_string(tz) == 'UTC'
Expand Down
1 change: 1 addition & 0 deletions python/requirements-wheel-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pickle5; platform_system != "Windows" and python_version < "3.8"
pytest
pytest-lazy-fixture
pytz
tzdata; sys_platform == 'win32'

numpy==1.19.5; platform_system == "Linux" and platform_machine == "aarch64" and python_version < "3.7"
numpy==1.21.3; platform_system == "Linux" and platform_machine == "aarch64" and python_version >= "3.7"
Expand Down

0 comments on commit 36a7f11

Please sign in to comment.