You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by jo...@apache.org on 2022/04/21 12:07:08 UTC

[arrow] branch master updated: ARROW-16233: [Python] [Packaging] test_zoneinfo_tzinfo_to_string fails with zoneinfo._common.ZoneInfoNotFoundError on packaging wheels on Windows

This is an automated email from the ASF dual-hosted git repository.

jorisvandenbossche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 36a7f114ce ARROW-16233: [Python] [Packaging] test_zoneinfo_tzinfo_to_string fails with zoneinfo._common.ZoneInfoNotFoundError on packaging wheels on Windows
36a7f114ce is described below

commit 36a7f114ce5826b911f58265ecfc8fab7bd8eddf
Author: Alenka Frim <fr...@gmail.com>
AuthorDate: Thu Apr 21 14:06:59 2022 +0200

    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 <fr...@gmail.com>
    Signed-off-by: Joris Van den Bossche <jo...@gmail.com>
---
 python/pyarrow/tests/strategies.py | 9 ++++++++-
 python/pyarrow/tests/test_types.py | 4 ++++
 python/requirements-wheel-test.txt | 1 +
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/python/pyarrow/tests/strategies.py b/python/pyarrow/tests/strategies.py
index 8460c5c6d1..48f7e53817 100644
--- a/python/pyarrow/tests/strategies.py
+++ b/python/pyarrow/tests/strategies.py
@@ -16,6 +16,7 @@
 # under the License.
 
 import datetime
+import sys
 
 import pytest
 import hypothesis as h
@@ -29,6 +30,11 @@ try:
     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
@@ -103,6 +109,7 @@ time_types = st.sampled_from([
     pa.time64('us'),
     pa.time64('ns')
 ])
+
 if tzst and zoneinfo:
     timezones = st.one_of(st.none(), tzst.timezones(), st.timezones())
 elif tzst:
@@ -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)
diff --git a/python/pyarrow/tests/test_types.py b/python/pyarrow/tests/test_types.py
index 679028118b..8cb7cea684 100644
--- a/python/pyarrow/tests/test_types.py
+++ b/python/pyarrow/tests/test_types.py
@@ -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'
diff --git a/python/requirements-wheel-test.txt b/python/requirements-wheel-test.txt
index d8af73da51..1644b2f8bc 100644
--- a/python/requirements-wheel-test.txt
+++ b/python/requirements-wheel-test.txt
@@ -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"