-
Notifications
You must be signed in to change notification settings - Fork 15
Description
freezegun allows a datetime spec string to encode a timezone offset like this:
>>> with freeze_time('2020-04-15 12:00 +1'):
... print(repr(datetime.datetime.now(tz=dateutil.tz.UTC)))
FakeDatetime(2020, 4, 15, 11, 0, tzinfo=tzutc())This produces a datetime with the offset given in the string, meaning that now will return datetimes relative to this.
tz_offset behaviour differs from offset string
This behaviour differs to the tz_offset parameter that fake_time takes, as with freezegun it's essentially pre-baked into the time, whereas fake_time then treats it as additive on top of the time spec.
Depending on how this is implemented/documented, this might be a breaking change. I'm not sure how much this library aims to maintain compatibility with freezegun. From reading the documentation I had assumed it was API compatible for the public API, but issues like this ended up causing issues in porting our codebase.
I'm not reporting this as a separate issue because it's not strictly an issue, but more just a gotcha for working around the main issue here – it bit us when we tried to use it as a workaround.
Note: to implement support for this will likely require addressing #59.