Skip to content

Support ics-vtimezones 2020.2 #79

Description

@jarrodmillman

See #78. With 2020.2, we get the following CI failure:

Run pytest --doctest-modules --durations=10
============================= test session starts =============================
platform win32 -- Python 3.10.11, pytest-7.4.4, pluggy-1.3.0
rootdir: D:\a\yaml2ics\yaml2ics
plugins: cov-4.1.0
collected 16 items

tests\test_calendar.py ......                                            [ 37%]
tests\test_cli.py F.                                                     [ 50%]
tests\test_events.py ...F...                                             [ 93%]
tests\test_include.py .                                                  [100%]

================================== FAILURES ===================================
__________________________________ test_cli ___________________________________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x0000016274518910>

    def test_cli(monkeypatch):
        with monkeypatch.context() as m:
            m.setattr(sys, "argv", ["yaml2ics.py", example_calendar])
>           main()

tests\test_cli.py:15: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
yaml2ics.py:201: in main
    calendar = files_to_calendar(files)
yaml2ics.py:180: in files_to_calendar
    all_events, name = files_to_events(files)
yaml2ics.py:169: in files_to_events
    all_events.append(event_from_yaml(event, tz=tz))
yaml2ics.py:117: in event_from_yaml
    add_recurrence_property(event, "EXDATE", exdates, tz)
yaml2ics.py:44: in add_recurrence_property
    params={"TZID": [str(ics.Timezone.from_tzinfo(tz))]} if tz else None,
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\ics\timezone\__init__.py:148: in from_tzinfo
    return Timezone_from_tzinfo(tzinfo, context)
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\ics\timezone\converters.py:74: in Timezone_from_tzinfo
    tz = func(tzinfo)
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\ics\timezone\converters.py:136: in Timezone_from_dateutil
    return Timezone.from_tzid(filename)
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\ics\timezone\__init__.py:140: in from_tzid
    return Timezone_from_tzid(tzid)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

tzid = 'US/Pacific'

    def Timezone_from_tzid(tzid: str) -> Timezone:
        import ics_vtimezones  # type: ignore
    
        tz_ics = ics_vtimezones.find_vtimezone_ics_file(tzid)
        if not tz_ics:
            olson_tzid = ics_vtimezones.windows_to_olson(tzid)
            if olson_tzid:
                tz_ics = ics_vtimezones.find_vtimezone_ics_file(olson_tzid)
        if not tz_ics:
>           raise ValueError(f"no vTimezone.ics file found for {tzid}")
E           ValueError: no vTimezone.ics file found for US/Pacific

C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\ics\timezone\converters.py:44: ValueError
_______________________________ test_exception ________________________________

    def test_exception():
>       event = event_from_yaml(
            parse_yaml(
                """
                summary: Recurring event with exception and additional date
                timezone: America/Los_Angeles
                begin: 2022-07-01 10:00:00
                duration: {minutes: 60}
                repeat:
                  interval:
                    hours: 4
                  until: 2022-07-31
                  except_on:
                    - 2022-07-13
                    - 2022-07-14 06:00:00
                  also_on:
                    - 2022-12-24 06:00:00
                """
            )
        )

tests\test_events.py:69: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
yaml2ics.py:117: in event_from_yaml
    add_recurrence_property(event, "EXDATE", exdates, tz)
yaml2ics.py:44: in add_recurrence_property
    params={"TZID": [str(ics.Timezone.from_tzinfo(tz))]} if tz else None,
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\ics\timezone\__init__.py:148: in from_tzinfo
    return Timezone_from_tzinfo(tzinfo, context)
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\ics\timezone\converters.py:74: in Timezone_from_tzinfo
    tz = func(tzinfo)
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\ics\timezone\converters.py:136: in Timezone_from_dateutil
    return Timezone.from_tzid(filename)
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\ics\timezone\__init__.py:140: in from_tzid
    return Timezone_from_tzid(tzid)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

tzid = 'US/Pacific'

    def Timezone_from_tzid(tzid: str) -> Timezone:
        import ics_vtimezones  # type: ignore
    
        tz_ics = ics_vtimezones.find_vtimezone_ics_file(tzid)
        if not tz_ics:
            olson_tzid = ics_vtimezones.windows_to_olson(tzid)
            if olson_tzid:
                tz_ics = ics_vtimezones.find_vtimezone_ics_file(olson_tzid)
        if not tz_ics:
>           raise ValueError(f"no vTimezone.ics file found for {tzid}")
E           ValueError: no vTimezone.ics file found for US/Pacific

C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\ics\timezone\converters.py:44: ValueError

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions