fixed unit tests by changing expected data types for prices. added dataload step to jenkins.sh

This commit is contained in:
fawce
2012-03-06 14:47:04 -05:00
parent 08506681d9
commit c7af92323f
4 changed files with 21 additions and 16 deletions
+4
View File
@@ -31,6 +31,10 @@ cp /mnt/jenkins/zipline_host_settings.py ./host_settings.py
#documentation output
paver apidocs html
#load treasury data
python dataloader.py tr
#load benchmark data
python dataloader.py bm
#run all the tests in test. see setup.cfg for flags.
nosetests
+1 -1
View File
@@ -222,7 +222,7 @@ class ParallelBuffer(Component):
try:
event = self.unframe(message)
# deserialization error
except zp.INVALID_DATASOURE_FRAME as exc:
except zp.INVALID_DATASOURCE_FRAME as exc:
return self.signal_exception(exc)
try:
+10 -9
View File
@@ -464,8 +464,8 @@ def TRADE_FRAME(event):
assert isinstance(event.source_id, basestring)
assert event.type == DATASOURCE_TYPE.TRADE
assert isinstance(event.sid, int)
assert isinstance(event.price, float)
assert isinstance(event.volume, int)
assert isinstance(event.price, numbers.Real)
assert isinstance(event.volume, numbers.Integral)
PACK_DATE(event)
return msgpack.dumps(tuple([
event.sid,
@@ -483,8 +483,8 @@ def TRADE_UNFRAME(msg):
sid, price, volume, epoch, micros, source_type, source_id = packed
assert isinstance(sid, int)
assert isinstance(price, float)
assert isinstance(volume, int)
assert isinstance(price, numbers.Real)
assert isinstance(volume, numbers.Integral)
rval = namedict({
'sid' : sid,
'price' : price,
@@ -531,8 +531,8 @@ def ORDER_UNFRAME(msg):
def TRANSACTION_FRAME(event):
assert isinstance(event, namedict)
assert isinstance(event.sid, int)
assert isinstance(event.price, float)
assert isinstance(event.commission, float)
assert isinstance(event.price, numbers.Real)
assert isinstance(event.commission, numbers.Real)
assert isinstance(event.amount, int)
PACK_DATE(event)
return msgpack.dumps(tuple([
@@ -549,8 +549,8 @@ def TRANSACTION_UNFRAME(msg):
sid, price, amount, commission, epoch, micros = msgpack.loads(msg)
assert isinstance(sid, int)
assert isinstance(price, float)
assert isinstance(commission, float)
assert isinstance(price, numbers.Real)
assert isinstance(commission, numbers.Real)
assert isinstance(amount, int)
rval = namedict({
'sid' : sid,
@@ -640,7 +640,8 @@ def UNPACK_DATE(event):
"""
Unpacks the datetime property of event from msgpack'able longs.
This function should be called purely for its side effects.
The event's 'dt' property is created by reading two longs: epoch and micros.
The event's 'dt' property is created by reading and then combining two longs: epoch and micros.
The epoch and micros properties are removed after dt is added.
UNPACK_DATE and PACK_DATE are inverse operations.
+6 -6
View File
@@ -26,14 +26,14 @@ class FinanceTestCase(TestCase):
def test_trade_feed_protocol(self):
# TODO: Perhaps something more self-documenting for variables names?
a = 133
b = [10] * 4
c = [100] * 4
sid = 133
price = [10.0] * 4
volume = [100] * 4
ts = datetime.strptime("02/15/2012","%m/%d/%Y")
dt = timedelta(days=1)
start_date = datetime.strptime("02/15/2012","%m/%d/%Y")
one_day_td = timedelta(days=1)
trades = factory.create_trade_history( a, b, c, ts, dt )
trades = factory.create_trade_history( sid, price, volume, start_date, one_day_td )
for trade in trades:
#simulate data source sending frame