1
0
mirror of https://github.com/bspeice/metrik synced 2024-11-23 07:38:09 -05:00

And make sure that we return a schedule

Rather than just create it.
This commit is contained in:
Bradlee Speice 2016-08-23 22:47:13 -04:00
parent 53407dad5c
commit 0eb0966729
4 changed files with 18 additions and 2 deletions

View File

@ -1,2 +1,2 @@
__version__ = '0.2.1' __version__ = '0.2.2'
__release__ = __version__ __release__ = __version__

View File

@ -6,6 +6,7 @@ from dateutil.parser import parse
from metrik.flows.rates_flow import LiborFlow from metrik.flows.rates_flow import LiborFlow
from metrik.flows.equities_flow import EquitiesFlow from metrik.flows.equities_flow import EquitiesFlow
from metrik import __version__
flows = { flows = {
'LiborFlow': LiborFlow, 'LiborFlow': LiborFlow,
@ -48,6 +49,8 @@ def handle_commandline():
parser.add_argument('-f', '--flow', dest='flow', help='The flow to be run') parser.add_argument('-f', '--flow', dest='flow', help='The flow to be run')
parser.add_argument('-l', '--list-flows', dest='list', action='store_true', parser.add_argument('-l', '--list-flows', dest='list', action='store_true',
help='List all available flows to be run.') help='List all available flows to be run.')
parser.add_argument('-v', '--version', action='version',
version=__version__)
args = parser.parse_args() args = parser.parse_args()
if args.cron: if args.cron:

View File

@ -5,7 +5,7 @@ from metrik.tasks.nasdaq import NasdaqETFList, NasdaqCompanyList
class EquitiesFlow(Flow): class EquitiesFlow(Flow):
@staticmethod @staticmethod
def get_schedule(): def get_schedule():
MarketClose() return MarketClose()
def _requires(self): def _requires(self):
return [NasdaqETFList(current_datetime=self.present, live=self.live), return [NasdaqETFList(current_datetime=self.present, live=self.live),

13
test/test_batch.py Normal file
View File

@ -0,0 +1,13 @@
from unittest import TestCase
from datetime import datetime
from metrik.batch import flows
class BatchTest(TestCase):
def test_flows_return_schedule(self):
present = datetime.now()
live = False
for flow_name, flow_class in flows.items():
assert flow_class(present=present,
live=live).get_schedule() is not None