mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 08:38:32 +02:00
Add UTC support for failing DayOne tests (#785)
* [Dayone] don't break if the system timezone is UTC * [DayOne] re-enable tests that were failing on Travis * [DayOne] change as per code review to avoid `except: pass`
This commit is contained in:
parent
8b7ebe2dcd
commit
66027e7746
2 changed files with 6 additions and 13 deletions
|
@ -1,7 +1,5 @@
|
|||
Feature: Dayone specific implementation details.
|
||||
|
||||
# fails when system time is UTC (as on Travis-CI)
|
||||
@skip
|
||||
Scenario: Loading a DayOne Journal
|
||||
Given we use the config "dayone.yaml"
|
||||
When we run "jrnl -from 'feb 2013'"
|
||||
|
@ -15,7 +13,7 @@ Feature: Dayone specific implementation details.
|
|||
2013-07-17 11:38 This entry is starred!
|
||||
"""
|
||||
|
||||
# fails when system time is UTC (as on Travis-CI)
|
||||
# broken still
|
||||
@skip
|
||||
Scenario: Entries without timezone information will be interpreted as in the current timezone
|
||||
Given we use the config "dayone.yaml"
|
||||
|
@ -23,7 +21,6 @@ Feature: Dayone specific implementation details.
|
|||
Then we should get no error
|
||||
and the output should contain "2013-01-17T18:37Z" in the local time
|
||||
|
||||
@skip
|
||||
Scenario: Writing into Dayone
|
||||
Given we use the config "dayone.yaml"
|
||||
When we run "jrnl 01 may 1979: Being born hurts."
|
||||
|
@ -33,8 +30,6 @@ Feature: Dayone specific implementation details.
|
|||
1979-05-01 09:00 Being born hurts.
|
||||
"""
|
||||
|
||||
# fails when system time is UTC (as on Travis-CI)
|
||||
@skip
|
||||
Scenario: Loading tags from a DayOne Journal
|
||||
Given we use the config "dayone.yaml"
|
||||
When we run "jrnl --tags"
|
||||
|
@ -44,8 +39,6 @@ Feature: Dayone specific implementation details.
|
|||
@play : 1
|
||||
"""
|
||||
|
||||
# fails when system time is UTC (as on Travis-CI)
|
||||
@skip
|
||||
Scenario: Saving tags from a DayOne Journal
|
||||
Given we use the config "dayone.yaml"
|
||||
When we run "jrnl A hard day at @work"
|
||||
|
@ -56,8 +49,6 @@ Feature: Dayone specific implementation details.
|
|||
@play : 1
|
||||
"""
|
||||
|
||||
# fails when system time is UTC (as on Travis-CI)
|
||||
@skip
|
||||
Scenario: Filtering by tags from a DayOne Journal
|
||||
Given we use the config "dayone.yaml"
|
||||
When we run "jrnl @work"
|
||||
|
@ -66,8 +57,6 @@ Feature: Dayone specific implementation details.
|
|||
2013-05-17 11:39 This entry has tags!
|
||||
"""
|
||||
|
||||
# fails when system time is UTC (as on Travis-CI)
|
||||
@skip
|
||||
Scenario: Exporting dayone to json
|
||||
Given we use the config "dayone.yaml"
|
||||
When we run "jrnl --export json"
|
||||
|
|
|
@ -52,7 +52,11 @@ class DayOne(Journal.Journal):
|
|||
except (KeyError, pytz.exceptions.UnknownTimeZoneError):
|
||||
timezone = tzlocal.get_localzone()
|
||||
date = dict_entry["Creation Date"]
|
||||
# convert the date to UTC rather than keep messing with
|
||||
# timezones
|
||||
if timezone.zone != "UTC":
|
||||
date = date + timezone.utcoffset(date, is_dst=False)
|
||||
|
||||
entry = Entry.Entry(
|
||||
self,
|
||||
date,
|
||||
|
|
Loading…
Add table
Reference in a new issue