System (or "local") time zone implementation for tz_local
that can handle DST and time zone transitions and is based on the time
module
#14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This addresses one of Arie Bovenberg's complaints in #12 regarding the
tz_local
attribute of heliclockter. It provides an own implementation that doesn't need thetzlocal
module (but can optionally utilize it to return a more useful value from the.key
attribute if it happens to be installed) and is properly sensitive toTZ
andtime.tzset()
.Note that this pull request depends on the fold attribute added in #13 which hasn't been merged yet (and as such is built on top of the commits from the
add-fold
branch). So please don't consider merging this before the other pull request has been merged and this one properly rebased against the resulting master.It's also fine to reject the pull request, if you don't want or need this in heliclockter.
Note that this also brings along a test suite with extensive checks against dates and times, many of which are possible edge cases. The test scaffolding could also be utilized for other existing tests. E.g. in
instantiation_test.py
it says "We cannot testdatetime_local
as the expected hour will vary on the system testing", which used to be true, but with thetzset
,systemtz
andwelldefined_timezone
fixtures it's now possible to test it as well. For that, it'd likely be desirable to move the fixtures to a more central place, such asconftest.py
, which would make them available to all tests.