Skip to content

[Python][CI] Failing test_dateutil_tzinfo_to_string due to new release of python-dateutil #40337

Open

Description

@AlenkaF

Describe the bug, including details regarding any error messages, version, and platform.

test_dateutil_tzinfo_to_string started failing with:

         tz = dateutil.tz.gettz('Europe/Paris')
>       assert pa.lib.tzinfo_to_string(tz) == 'Europe/Paris'
E       AssertionError: assert 'Europe/Monaco' == 'Europe/Paris'
E         - Europe/Paris
E         + Europe/Monaco

see: https://github.com/ursacomputing/crossbow/actions/runs/8103088008/job/22164107523#step:6:4305.

This is most probably due to new release of python-dateutil package.

The test is failing on the CI now also, with dateutil 2.9.0: https://ci.appveyor.com/project/ApacheSoftwareFoundation/arrow/builds/49322144?fullLog=true

Upstream issue: dateutil/dateutil#1353

Component(s)

Continuous Integration, Python

Activity

  1. AlenkaF commented on Mar 4, 2024

    @AlenkaF
    MemberAuthor
  2. jorisvandenbossche commented on Mar 4, 2024

    @jorisvandenbossche
    Member

    I can't reproduce this on Linux, so most probably a Windows issue (or related to the exact tzdata being used there, since for me locally it's using the system provided data)

    Might be good to report upstream?

  3. jorisvandenbossche commented on Mar 4, 2024

    @jorisvandenbossche
    Member

    The logic we use to convert a dateutil tz to a string:

    // if dateutil is installed and tzinfo is an instance of dateutil.tz.tzfile
    if (module_dateutil.obj() != nullptr &&
    PyObject_IsInstance(tzinfo, class_tzfile.obj())) {
    OwnedRef _filename(PyObject_GetAttrString(tzinfo, "_filename"));
    RETURN_IF_PYERROR();
    std::string result;
    RETURN_NOT_OK(internal::PyUnicode_AsStdString(_filename.obj(), &result));
    // _filename returns a full path in general ('/usr/share/zoneinfo/Europe/Paris')
    // or POSIX name on Windows ('Europe/Paris') - we need a substring in first case
    std::size_t pos = result.find("zoneinfo/");
    if (pos != std::string::npos) {
    return result.substr(pos + 9);
    }
    return result;
    }

    (so it might also be that something changed under the hood in dateutil that messes that u. It would be good to verify if the actual tz object in the snippet above, before conversion to a string by pyarrow, also shows "Europe/Monaco")

  4. AlenkaF commented on Mar 4, 2024

    @AlenkaF
    MemberAuthor

    Agree with you Joris. I would first like to check the behaviour of dateutil, as you mention, but also can't do that on my M1. I could in any case open an issue upstream before, if we think that makes sense.

  5. raulcd commented on Mar 4, 2024

    @raulcd
    Member

    The same issue is being reproduced on my PR on the conda feedstock on Windows:
    https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=888527&view=logs&j=ab98fee7-5bc6-5c2f-a410-3ab9b2f2e8ca&t=472408ae-fc68-5791-981c-69ea41d2d692&l=38399

        def test_dateutil_tzinfo_to_string():
            pytest.importorskip("dateutil")
            import dateutil.tz
        
            tz = dateutil.tz.UTC
            assert pa.lib.tzinfo_to_string(tz) == 'UTC'
            tz = dateutil.tz.gettz('Europe/Paris')
    >       assert pa.lib.tzinfo_to_string(tz) == 'Europe/Paris'
    E       AssertionError: assert 'Europe/Monaco' == 'Europe/Paris'
    E         - Europe/Paris
    E         + Europe/Monaco
    

    Edit: added on Windows

  6. jorisvandenbossche commented on Mar 12, 2024

    @jorisvandenbossche
    Member

    A temporary skip was added in #40486

  7. added this to the 16.0.0 milestone on Mar 12, 2024
  8. modified the milestones: 16.0.0, 17.0.0 on Apr 8, 2024
  9. rok commented on Mar 19, 2025

    @rok
    Member

    This was reported upstream: dateutil/dateutil#1353

  10. removed this from the 20.0.0 milestone on Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions