Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-16233

[Python] [Packaging] test_zoneinfo_tzinfo_to_string fails with zoneinfo._common.ZoneInfoNotFoundError on packaging wheels on Windows

    XMLWordPrintableJSON

Details

    Description

      Currently our nightly-packaging jobs for windows wheels are failing, see:

      The error is from the test:

      pyarrow\tests\test_types.py::test_zoneinfo_tzinfo_to_string, see the error logs below:

      ================================== 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'
       

      Attachments

        Issue Links

          Activity

            People

              alenka Alenka Frim
              raulcd Raúl Cumplido
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 4h 50m
                  4h 50m