[
https://issues.apache.org/jira/browse/ARROW-16233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17524333#comment-17524333
]
Joris Van den Bossche commented on ARROW-16233:
-----------------------------------------------
> We could skip the test on Windows if tzdata is not installed, but perhaps we
> can instead make PyArrow depend on tzdata on Windows?
The minimal thing to do is indeed add a skip to the test for when {{tzdata}} is
not installed (only for windows). And for our own windows builds, also add
tzdata to the environment to have test coverage.
For making it an actual optional windows-only dependency, I am not fully sure,
since this is only needed when you actually are using zoneinfo timezones (not
everyone uses timezones, and if you do there are alternatives (eg we still
default to pytz, although we should change that to zoneinfo at some point))
> [Python] [Packaging] test_zoneinfo_tzinfo_to_string fails with
> zoneinfo._common.ZoneInfoNotFoundError on packaging wheels on Windows
> ------------------------------------------------------------------------------------------------------------------------------------
>
> Key: ARROW-16233
> URL: https://issues.apache.org/jira/browse/ARROW-16233
> Project: Apache Arrow
> Issue Type: Bug
> Components: Packaging, Python
> Reporter: Raúl Cumplido
> Priority: Blocker
> Fix For: 8.0.0
>
>
> Currently our nightly-packaging jobs for windows wheels are failing, see:
> - wheel-windows-cp310-amd64:
> URL:
> [https://github.com/ursacomputing/crossbow/tree/nightly-packaging-2022-04-18-0-github-wheel-windows-cp310-amd64]
> - wheel-windows-cp39-amd64:
> URL:
> [https://github.com/ursacomputing/crossbow/tree/nightly-packaging-2022-04-18-0-github-wheel-windows-cp39-amd64]
> The error is from the test:
> pyarrow\tests\test_types.py::test_zoneinfo_tzinfo_to_string, see the error
> logs below:
> {code:java}
> ================================== FAILURES
> ===================================
> _______________________ test_zoneinfo_tzinfo_to_string
> ________________________key = 'UTC' def load_tzdata(key):
> import importlib.resources
>
> components = key.split("/")
> package_name = ".".join(["tzdata.zoneinfo"] + components[:-1])
> resource_name = components[-1]
>
> try:
> > return importlib.resources.open_binary(package_name,
> > resource_name)Python\lib\zoneinfo\_common.py:12:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _package = 'tzdata.zoneinfo', resource = 'UTC' def open_binary(package:
> Package, resource: Resource) -> BinaryIO:
> """Return a file-like object opened for binary reading of the
> resource."""
> resource = _common.normalize_path(resource)
> > package =
> > _common.get_package(package)Python\lib\importlib\resources.py:43:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _package = 'tzdata.zoneinfo' def get_package(package):
> # type: (Package) -> types.ModuleType
> """Take a package name or module object and return the module.
>
> Raise an exception if the resolved module is not a package.
> """
> > resolved = resolve(package)Python\lib\importlib\_common.py:66:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _cand = 'tzdata.zoneinfo' def resolve(cand):
> # type: (Package) -> types.ModuleType
> > return cand if isinstance(cand, types.ModuleType) else
> > importlib.import_module(cand)Python\lib\importlib\_common.py:57:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _name = 'tzdata.zoneinfo', package = None def import_module(name,
> package=None):
> """Import a module.
>
> The 'package' argument is required when performing a relative import.
> It
> specifies the package to use as the anchor point from which to
> resolve the
> relative import to an absolute import.
>
> """
> level = 0
> if name.startswith('.'):
> if not package:
> msg = ("the 'package' argument is required to perform a
> relative "
> "import for {!r}")
> raise TypeError(msg.format(name))
> for character in name:
> if character != '.':
> break
> level += 1
> > return _bootstrap._gcd_import(name[level:], package,
> > level)Python\lib\importlib\__init__.py:126:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _name = 'tzdata.zoneinfo', package = None, level = 0> ???<frozen
> importlib._bootstrap>:1050:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _name = 'tzdata.zoneinfo', import_ = <function _gcd_import at
> 0x00000216E11A3490>> ???<frozen importlib._bootstrap>:1027:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _name = 'tzdata.zoneinfo', import_ = <function _gcd_import at
> 0x00000216E11A3490>> ???<frozen importlib._bootstrap>:992:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _f = <function _gcd_import at 0x00000216E11A3490>, args = ('tzdata',), kwds =
> {}> ???<frozen importlib._bootstrap>:241:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _name = 'tzdata', package = None, level = 0> ???<frozen
> importlib._bootstrap>:1050:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _name = 'tzdata', import_ = <function _gcd_import at 0x00000216E11A3490>>
> ???<frozen importlib._bootstrap>:1027:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _name = 'tzdata', import_ = <function _gcd_import at 0x00000216E11A3490>>
> ???
> E ModuleNotFoundError: No module named 'tzdata'<frozen
> importlib._bootstrap>:1004: ModuleNotFoundErrorDuring handling of the above
> exception, another exception occurred: def
> test_zoneinfo_tzinfo_to_string():
> zoneinfo = pytest.importorskip('zoneinfo')
>
> > tz =
> > zoneinfo.ZoneInfo('UTC')Python\lib\site-packages\pyarrow\tests\test_types.py:329:
> >
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _key = 'UTC' def load_tzdata(key):
> import importlib.resources
>
> components = key.split("/")
> package_name = ".".join(["tzdata.zoneinfo"] + components[:-1])
> resource_name = components[-1]
>
> try:
> return importlib.resources.open_binary(package_name,
> resource_name)
> except (ImportError, FileNotFoundError, UnicodeEncodeError):
> # There are three types of exception that can be raised that all
> amount
> # to "we cannot find this key":
> #
> # ImportError: If package_name doesn't exist (e.g. if tzdata is
> not
> # installed, or if there's an error in the folder name like
> # Amrica/New_York)
> # FileNotFoundError: If resource_name doesn't exist in the package
> # (e.g. Europe/Krasnoy)
> # UnicodeEncodeError: If package_name or resource_name are not
> UTF-8,
> # such as keys containing a surrogate character.
> > raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
> E zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with
> key UTC'
> {code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)