Run tests located in different time zones
niccokunzmann opened this issue · comments
The tests are currently running in the timezone of the server.
#466 (comment)
shows that the TZ
environment variable has an influence on the behavior of icalendar.
I would like to be sure that the tests work independent of the time zone that they run in.
tox
should isolate the tests from the environment variables and as such always have TZ
not set.
Can we make the tests run in different time zones?
Related Work
An idea of how to do it is in recurring_ical_events
:
- https://github.com/niccokunzmann/python-recurring-ical-events/blob/c35ba2ffbc5c7352bff6b6077ebdf64756bf6ce6/.github/workflows/tests.yml#L18
- https://github.com/niccokunzmann/python-recurring-ical-events/blob/c35ba2ffbc5c7352bff6b6077ebdf64756bf6ce6/test/conftest.py#L26
- https://github.com/niccokunzmann/python-recurring-ical-events/blob/c35ba2ffbc5c7352bff6b6077ebdf64756bf6ce6/tox.ini#L12
Possible implementation
Maybe, tox can be used to set the TZ
variable when the tests are run?
When working on todoman a common pattern we noticed is test breaking depending on whether the timezone is east of UTC or west of UTC (and usually, the failure was due an actual bug).
I think usually testing with Argentina (UTC-3), Germany (UTC+1) and Japan (UTC+9) helps find a lot of bugs. It's also useful to test things close to midnight UTC, since it's a different day in different timezones.