mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Fix that goddamn timezone test
This commit is contained in:
parent
bf2cdc4995
commit
3408440705
1 changed files with 4 additions and 2 deletions
|
@ -16,9 +16,12 @@ except ImportError:
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
import tzlocal
|
import tzlocal
|
||||||
import shlex
|
import shlex
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def ushlex(command):
|
def ushlex(command):
|
||||||
|
if sys.version_info[0] == 3:
|
||||||
|
return shlex.split(command)
|
||||||
return map(lambda s: s.decode('UTF8'), shlex.split(command.encode('utf8')))
|
return map(lambda s: s.decode('UTF8'), shlex.split(command.encode('utf8')))
|
||||||
|
|
||||||
|
|
||||||
|
@ -150,8 +153,7 @@ def check_output_time_inline(context, text):
|
||||||
out = context.stdout_capture.getvalue()
|
out = context.stdout_capture.getvalue()
|
||||||
local_tz = tzlocal.get_localzone()
|
local_tz = tzlocal.get_localzone()
|
||||||
utc_time = date_parser.parse(text)
|
utc_time = date_parser.parse(text)
|
||||||
date = utc_time + local_tz._utcoffset
|
local_date = utc_time.astimezone(local_tz).strftime("%Y-%m-%d %H:%M")
|
||||||
local_date = date.strftime("%Y-%m-%d %H:%M")
|
|
||||||
assert local_date in out, local_date
|
assert local_date in out, local_date
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue