diff --git a/tests/test_examples.py b/tests/test_examples.py index 67d83975..5c93547b 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -26,6 +26,8 @@ from nose_parameterized import parameterized import os from unittest import TestCase +from zipline.utils import parse_args, run_pipeline + # Otherwise the next line sometimes complains about being run too late. _multiprocess_can_split_ = False @@ -39,8 +41,15 @@ def example_dir(): class ExamplesTests(TestCase): - # Test algorithms as if they being executed directly from the command line. + # Test algorithms as if they are executed directly from the command line. @parameterized.expand(((os.path.basename(f).replace('.', '_'), f) for f in glob.glob(os.path.join(example_dir(), '*.py')))) def test_example(self, name, example): imp.load_source('__main__', os.path.basename(example), open(example)) + + # Test algorithm as if scripts/run_algo.py is being used. + def test_example_run_pipline(self): + example = os.path.join(example_dir(), 'buyapple.py') + confs = ['-f', example, '--start', '2011-1-1', '--end', '2012-1-1'] + parsed_args = parse_args(confs) + run_pipeline(**parsed_args)