Skip to content

Commit

Permalink
Fix tests: list_versions() now has a time-zoned date
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesblackburn committed Aug 19, 2015
1 parent 1959f49 commit e091661
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions tests/integration/store/test_version_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from arctic.exceptions import NoDataFoundException, DuplicateSnapshotException

from ...util import read_str_as_pandas
from arctic.date._mktz import mktz


ts1 = read_str_as_pandas(""" times | near
Expand Down Expand Up @@ -285,7 +286,7 @@ def test_query_version_as_of_int(library):
def test_list_version(library):
assert len(list(library.list_versions(symbol))) == 0
dates = [None, None, None]
now = dt.utcnow()
now = dt.utcnow().replace(tzinfo=mktz('UTC'))
for x in xrange(len(dates)):
dates[x] = now - dtd(minutes=130 - x)
with patch("bson.ObjectId", return_value=bson.ObjectId.from_datetime(dates[x])):
Expand All @@ -305,7 +306,7 @@ def test_list_version(library):
def test_list_version_latest_only(library):
assert len(list(library.list_versions(symbol))) == 0
dates = [None, None, None]
now = dt.utcnow()
now = dt.utcnow().replace(tzinfo=mktz('UTC'))
for x in xrange(len(dates)):
dates[x] = now - dtd(minutes=20 - x)
with patch("bson.ObjectId", return_value=bson.ObjectId.from_datetime(dates[x])):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/store/test_version_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_list_versions_localTime():
'symbol': 's', 'version': 10}]

version = list(VersionStore.list_versions(vs, "symbol"))[0]
local_date = date.replace(tzinfo=mktz("UTC")).astimezone(mktz()).replace(tzinfo=None)
local_date = date.replace(tzinfo=mktz("UTC"))
assert version == {'symbol': version['symbol'], 'version': version['version'],
# We return naive datetimes in 'default' time, which is London for us
'date': local_date,
Expand Down

0 comments on commit e091661

Please sign in to comment.