From 7e81f78a6d70a9efe3e621ac1939bbbda623779b Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Wed, 24 Aug 2016 07:09:43 -0400 Subject: [PATCH] Make sure there's a newline for the cron jobs --- metrik/__init__.py | 2 +- metrik/batch.py | 2 +- test/test_batch.py | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/metrik/__init__.py b/metrik/__init__.py index 34cdcbc..73d59c8 100644 --- a/metrik/__init__.py +++ b/metrik/__init__.py @@ -1,2 +1,2 @@ -__version__ = '0.2.2' +__version__ = '0.2.3' __release__ = __version__ \ No newline at end of file diff --git a/metrik/batch.py b/metrik/batch.py index 09de0cc..8bdb788 100644 --- a/metrik/batch.py +++ b/metrik/batch.py @@ -29,7 +29,7 @@ def build_cron_file(): cron_string + ' ' + EXEC + ' ' + FLOW_FLAG + ' ' + flow_name ) - return '\n'.join(cron_strings) + return '\n'.join(cron_strings) + '\n' def list_flows(): diff --git a/test/test_batch.py b/test/test_batch.py index 67a3828..09a02a7 100644 --- a/test/test_batch.py +++ b/test/test_batch.py @@ -1,7 +1,7 @@ from unittest import TestCase from datetime import datetime -from metrik.batch import flows +from metrik.batch import flows, build_cron_file class BatchTest(TestCase): @@ -11,3 +11,8 @@ class BatchTest(TestCase): for flow_name, flow_class in flows.items(): assert flow_class(present=present, live=live).get_schedule() is not None + + def test_cron_string(self): + cron_string = build_cron_file() + assert len(cron_string.split('\n')) == len(flows) + 1 + assert cron_string[-1] == '\n'