Skip to content

Commit dc7be90

Browse files
Merge pull request pandas-dev#4 from jamesblackburn/circleci_build_and_cov
Circleci build and tests
2 parents 2307ed9 + 5af2ce3 commit dc7be90

File tree

7 files changed

+33
-16
lines changed

7 files changed

+33
-16
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [Arctic TimeSeries and Tick store](https://github.com/ahlmss/arctic)
22

3+
[![Circle CI](https://circleci.com/gh/ahlmss/arctic.svg?style=shield)](https://circleci.com/gh/ahlmss/arctic)
4+
35
Arctic is a high performance datastore for numeric data. It supports [Pandas](http://pandas.pydata.org/),
46
[numpy](http://www.numpy.org/) arrays and pickled objects out-of-the-box, with pluggable support for
57
other data types and optional versioning.

arctic/_compression.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
from .logging import logger
2-
import _compress as clz4
2+
3+
try:
4+
from . import _compress as clz4
5+
except ImportError:
6+
logger.warn("Couldn't import cython lz4")
7+
import lz4 as clz4
38

49

510
USE_LZ4HC = True # switch to use LZ4HC. Default True

tests/integration/store/test_pickle_store.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_get_info_bson_object(library):
2929

3030
def test_bson_large_object(library):
3131
blob = {'foo': dt(2015, 1, 1), 'object': Arctic,
32-
'large_thing': np.random.rand(2.1 * 1024 * 1024).tostring()}
32+
'large_thing': np.random.rand(int(2.1 * 1024 * 1024)).tostring()}
3333
assert len(blob['large_thing']) > 16 * 1024 * 1024
3434
library.write('BLOB', blob)
3535
saved_blob = library.read('BLOB').data

tests/unit/date/test_datetime_to_ms_roundtrip.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from datetime import datetime as dt
44
import pytz
55
from arctic.date import mktz, datetime_to_ms, ms_to_datetime
6+
from arctic.date._mktz import DEFAULT_TIME_ZONE_NAME
67

78

89
def assert_roundtrip(tz):
@@ -33,7 +34,7 @@ def test_UTC_roundtrip():
3334
assert_roundtrip(tz)
3435

3536

36-
def test_weird_get_tz_London():
37+
def test_weird_get_tz_local():
3738
tz = get_tz()
3839
assert_roundtrip(tz)
3940

@@ -50,7 +51,7 @@ def test_mktz_London():
5051
assert_roundtrip(tz)
5152

5253

53-
def test_datetime_roundtrip_lon_no_tz():
54+
def test_datetime_roundtrip_local_no_tz():
5455
pdt = datetime.datetime(2012, 6, 12, 12, 12, 12, 123000)
5556
pdt2 = ms_to_datetime(datetime_to_ms(pdt))
5657
assert pdt2 == pdt
@@ -60,21 +61,21 @@ def test_datetime_roundtrip_lon_no_tz():
6061
assert pdt2 == pdt
6162

6263

63-
def test_datetime_roundtrip_lon_tz():
64-
pdt = datetime.datetime(2012, 6, 12, 12, 12, 12, 123000, tzinfo=mktz('Europe/London'))
64+
def test_datetime_roundtrip_local_tz():
65+
pdt = datetime.datetime(2012, 6, 12, 12, 12, 12, 123000, tzinfo=mktz(DEFAULT_TIME_ZONE_NAME))
6566
pdt2 = ms_to_datetime(datetime_to_ms(pdt))
6667
assert pdt2 == pdt.replace(tzinfo=None)
6768

68-
pdt = datetime.datetime(2012, 1, 12, 12, 12, 12, 123000, tzinfo=mktz('Europe/London'))
69+
pdt = datetime.datetime(2012, 1, 12, 12, 12, 12, 123000, tzinfo=mktz(DEFAULT_TIME_ZONE_NAME))
6970
pdt2 = ms_to_datetime(datetime_to_ms(pdt))
7071
assert pdt2 == pdt.replace(tzinfo=None)
7172

7273

7374
def test_datetime_roundtrip_est_tz():
7475
pdt = datetime.datetime(2012, 6, 12, 12, 12, 12, 123000, tzinfo=mktz('EST'))
7576
pdt2 = ms_to_datetime(datetime_to_ms(pdt))
76-
assert pdt2.replace(tzinfo=mktz('Europe/London')) == pdt
77+
assert pdt2.replace(tzinfo=mktz(DEFAULT_TIME_ZONE_NAME)) == pdt
7778

7879
pdt = datetime.datetime(2012, 1, 12, 12, 12, 12, 123000, tzinfo=mktz('EST'))
7980
pdt2 = ms_to_datetime(datetime_to_ms(pdt))
80-
assert pdt2.replace(tzinfo=mktz('Europe/London')) == pdt
81+
assert pdt2.replace(tzinfo=mktz(DEFAULT_TIME_ZONE_NAME)) == pdt

tests/unit/date/test_mktz.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
from pytest import raises
44

55
from arctic.date import mktz, TimezoneError
6+
from arctic.date._mktz import DEFAULT_TIME_ZONE_NAME
67

78

89
def test_mktz():
9-
tz = mktz()
10+
tz = mktz("Europe/London")
1011
d = dt(2012, 2, 2, tzinfo=tz)
1112
assert d.tzname() == 'GMT'
1213
d = dt(2012, 7, 2, tzinfo=tz)
@@ -19,6 +20,11 @@ def test_mktz():
1920
assert d.tzname() == 'UTC' # --------replace_empty_timezones_with_default -----------------
2021

2122

23+
def test_mktz_noarg():
24+
tz = mktz()
25+
assert DEFAULT_TIME_ZONE_NAME in str(tz)
26+
27+
2228
def test_mktz_zone():
2329
tz = mktz('UTC')
2430
assert tz.zone == "UTC"

tests/unit/date/test_util.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from datetime import datetime as dt
55
from arctic.date import datetime_to_ms, ms_to_datetime, mktz, to_pandas_closed_closed, DateRange, OPEN_OPEN, CLOSED_CLOSED
6+
from arctic.date._mktz import DEFAULT_TIME_ZONE_NAME
67

78

89
@pytest.mark.parametrize('pdt', [
@@ -23,7 +24,7 @@ def test_datetime_to_ms_and_back(pdt):
2324

2425

2526
def test_datetime_to_ms_and_back_microseconds():
26-
pdt = dt(2012, 8, 1, 12, 34, 56, 999999, tzinfo=mktz('Europe/London'))
27+
pdt = dt(2012, 8, 1, 12, 34, 56, 999999, tzinfo=mktz(DEFAULT_TIME_ZONE_NAME))
2728
i = datetime_to_ms(pdt)
2829
pdt = pdt.replace(tzinfo=None)
2930
pdt2 = ms_to_datetime(i)

tests/unit/store/test_version_store.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,21 @@ def test_delete_version_version_not_found():
2626
logger.error.assert_called_once_with("Can't delete sentinel.symbol:sentinel.version as not found in DB")
2727

2828

29-
def test_list_versions_LondonTime():
29+
def test_list_versions_localTime():
3030
# Object ID's are stored in UTC. We need to ensure that the returned times
31-
# for versions are in the local London TimeZone
31+
# for versions are in the local TimeZone
3232
vs = create_autospec(VersionStore, instance=True,
3333
_versions=Mock())
3434
vs._find_snapshots.return_value = 'snap'
35-
vs._versions.find.return_value = [{'_id': bson.ObjectId.from_datetime(dt(2013, 4, 1, 9, 0)),
36-
'symbol': 's', 'version': 10}]
35+
date = dt(2013, 4, 1, 9, 0)
36+
vs._versions.find.return_value = [{'_id': bson.ObjectId.from_datetime(date),
37+
'symbol': 's', 'version': 10}]
3738

3839
version = list(VersionStore.list_versions(vs, "symbol"))[0]
40+
local_date = date.replace(tzinfo=mktz("UTC")).astimezone(mktz()).replace(tzinfo=None)
3941
assert version == {'symbol': version['symbol'], 'version': version['version'],
4042
# We return naive datetimes in 'default' time, which is London for us
41-
'date': dt(2013, 4, 1, 10, 0),
43+
'date': local_date,
4244
'snapshots': 'snap'}
4345

4446

0 commit comments

Comments
 (0)