allenporter/ical

Using fake date/time types with @pytest.mark.parametrize fails component init

allenporter opened this issue · 0 comments

Describe the bug
A clear and concise description of what the bug is, and the version of the ics library used.

Traceback (most recent call last):
  File "/home/runner/work/core/core/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/home/runner/work/core/core/homeassistant/components/calendar/__init__.py", line 593, in handle_calendar_event_create
    await entity.async_create_event(**msg[CONF_EVENT])
  File "/home/runner/work/core/core/homeassistant/components/local_calendar/calendar.py", line 112, in async_create_event
    await self._async_store()
  File "/home/runner/work/core/core/homeassistant/components/local_calendar/calendar.py", line 105, in _async_store
    content = IcsCalendarStream.calendar_to_ics(self._calendar)
  File "/home/runner/work/core/core/venv/lib/python3.10/site-packages/ical/calendar_stream.py", line 85, in calendar_to_ics
    return stream.ics()
  File "/home/runner/work/core/core/venv/lib/python3.10/site-packages/ical/calendar_stream.py", line 65, in ics
    return encode_content(self.__encode_component_root__().components)
  File "/home/runner/work/core/core/venv/lib/python3.10/site-packages/ical/component.py", line 212, in __encode_component_root__
    return self.__encode_component__(self.__class__.__name__, model_data)
  File "/home/runner/work/core/core/venv/lib/python3.10/site-packages/ical/component.py", line 236, in __encode_component__
    parent.components.append(component_encoder(key, value))
  File "/home/runner/work/core/core/venv/lib/python3.10/site-packages/ical/component.py", line 236, in __encode_component__
    parent.components.append(component_encoder(key, value))
  File "/home/runner/work/core/core/venv/lib/python3.10/site-packages/ical/component.py", line 238, in __encode_component__
    if prop := cls._encode_property(key, field.type_, value):
  File "/home/runner/work/core/core/venv/lib/python3.10/site-packages/ical/component.py", line 248, in _encode_property
    for sub_type in cls._get_field_types(field_type):
  File "/home/runner/work/core/core/venv/lib/python3.10/site-packages/ical/component.py", line [198](https://github.com/home-assistant/core/actions/runs/4625525139/jobs/8181397369#step:10:199), in _get_field_types
    sortable_args.sort(reverse=True)
TypeError: '<' not supported between instances of 'FakeDatetimeMeta' and 'FakeDateMeta'

To Reproduce
Fails on CI for home-assistant

Expected behavior
Not deterministic

Additional context