Open 0-wiz-0 opened 1 month ago
Thanks for reporting this. It seems we have an assumption that works on Debian:
zoneinfo.ZoneInfo(key='Europe/Vienna') == tzfile('/usr/share/zoneinfo/Europe/Vienna')
I guess, this just needs a different function to compare datetime for equality. That would fix the tests. Would you like to take this on?
One could also add another operating system in the CI if that is wished for. I do not know how otherwise we will be able to prevent this in the future.
I don't feel comfortable tackling this, since I don't know the code at all. I tried playing around with Python and got this far:
>>> import zoneinfo
>>> from dateutil import tz
>>> zoneinfo.ZoneInfo(key='Europe/Vienna') == tz.tzfile('/usr/share/zoneinfo/Europe/Vienna')
False
>>> print(zoneinfo.ZoneInfo(key='Europe/Vienna'), tz.tzfile('/usr/share/zoneinfo/Europe/Vienna'))
Europe/Vienna tzfile('/usr/share/zoneinfo/Europe/Vienna')
Is that what the test code is currently doing? These objects look quite different to me :-)
The path to the zone file is the same on NetBSD:
-r--r--r-- 1 root wheel 658 Oct 12 11:13 /usr/share/zoneinfo/Europe/Vienna
I think, for now, I would assume that icalendar does work under that OS. However, the tests do not run because the timezones have a different module as origin.
(1) I think that there should be some way to track this down. (2) But we can also make tests more generic.
I like option 2.
E.g. this line can be changed:
assert exdate[i].dts[0].dt == in_timezone(exception_date, 'Europe/Vienna')
to
assert_datetime_is_in_timezone(exdate[i].dts[0].dt, exception_date, 'Europe/Vienna')
and that makes sure that the datetime is equal and the timezone has the string 'Europe/Vienna' in it. I think, that is enough testing... identity of the timezones is not required but only an assumption here. We want the timezone object to be any 'Europe/Vienna' timezone and not necessarily be a ZoneInfo object.
What are your thoughts on this? If you need any help to get this done, I am here. Your contribution is much appreciated!
Describe the bug
When running the self tests for 6.0.1 on NetBSD 10.99.12/amd64, there are about 20 self test failures due to timezone issues.
To Reproduce
One example of the detailed output of a test:
Expected behavior
No errors.
Environment
icalendar
version: 6.0.1Additional context
n/a