Merge lp:~rockstar/entertainer/fix-weather-tests-again into lp:entertainer
Proposed by
Paul Hummer
Status: | Merged |
---|---|
Approved by: | Matt Layman |
Approved revision: | 370 |
Merged at revision: | not available |
Proposed branch: | lp:~rockstar/entertainer/fix-weather-tests-again |
Merge into: | lp:entertainer |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~rockstar/entertainer/fix-weather-tests-again |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Matt Layman | Approve | ||
Review via email: mp+6241@code.launchpad.net |
Commit message
The weather tests are no longer fragile to what time of day it is, or what timezone it is.
To post a comment you must log in.
This branch looks a lot more heavy than it really is. For us that don't live in England, there are windows of time where one of the weather tests doesn't pass. This is because my datetime.now() is a different day than what day Google knows it is in Bath, England.
Initially, I thought datetime.utcnow() would be fine, since UTC 0 is England, but that still doesn't work, because utcnow() doesn't compensate for DST. The solution in this branch implements a tzinfo object specific to England, which I could then pass to datetime.now to specify a timezone which understands DST.
This will make the tests pass no matter what time it is in your local timezone, and no matter whether or not it's DST.