From 0eb09667295814cf21ad554e42901a2a81861bde Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Tue, 23 Aug 2016 22:47:13 -0400 Subject: [PATCH] And make sure that we return a schedule Rather than just create it. --- metrik/__init__.py | 2 +- metrik/batch.py | 3 +++ metrik/flows/equities_flow.py | 2 +- test/test_batch.py | 13 +++++++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 test/test_batch.py diff --git a/metrik/__init__.py b/metrik/__init__.py index ddbe79e..34cdcbc 100644 --- a/metrik/__init__.py +++ b/metrik/__init__.py @@ -1,2 +1,2 @@ -__version__ = '0.2.1' +__version__ = '0.2.2' __release__ = __version__ \ No newline at end of file diff --git a/metrik/batch.py b/metrik/batch.py index 78d9d7b..09de0cc 100644 --- a/metrik/batch.py +++ b/metrik/batch.py @@ -6,6 +6,7 @@ from dateutil.parser import parse from metrik.flows.rates_flow import LiborFlow from metrik.flows.equities_flow import EquitiesFlow +from metrik import __version__ flows = { '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('-l', '--list-flows', dest='list', action='store_true', help='List all available flows to be run.') + parser.add_argument('-v', '--version', action='version', + version=__version__) args = parser.parse_args() if args.cron: diff --git a/metrik/flows/equities_flow.py b/metrik/flows/equities_flow.py index a55e9f9..6c3d188 100644 --- a/metrik/flows/equities_flow.py +++ b/metrik/flows/equities_flow.py @@ -5,7 +5,7 @@ from metrik.tasks.nasdaq import NasdaqETFList, NasdaqCompanyList class EquitiesFlow(Flow): @staticmethod def get_schedule(): - MarketClose() + return MarketClose() def _requires(self): return [NasdaqETFList(current_datetime=self.present, live=self.live), diff --git a/test/test_batch.py b/test/test_batch.py new file mode 100644 index 0000000..67a3828 --- /dev/null +++ b/test/test_batch.py @@ -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