def test_batch_go(self):
    args = ['-F', 'iter_{0}.testout', '-N', '4', '-O', self.dir, '-S', 'results.testout', '--test']
    assert (self.batch.go(option_args=args) is None)
    assert_equal(self.batch.options.test, True)
    assert_equal(self.batch.options.dup, 4)
    assert_equal(self.batch.options.output_dir, self.dir)
    assert_equal(self.batch.options.output_file, 'iter_{0}.testout')
    assert_equal(self.batch.options.file_dump, True)
    assert_equal(self.batch.options.stats_file, 'results.testout')
    assert (self.batch.options.pool_size is None), 'Pool size is not None'
    assert_equal(self.batch.options.quiet, False)
    assert_equal(self.batch.data['test'], True)
    for i in range(4):
        assert os.path.isfile(((self.dir + os.sep) + 'iter_{0}.testout'.format((i + 1)))), 'Dup file {0} is missing'.format((i + 1))
    assert os.path.isfile(((self.dir + os.sep) + 'results.testout')), 'Results file is missing'
    for i in range(4):
        with open(((self.dir + os.sep) + 'iter_{0}.testout'.format((i + 1))), 'r') as dup_file:
            assert_equal(dup_file.read(), 'runs\n')
    with open(((self.dir + os.sep) + 'results.testout'), 'r') as results_file:
        should_be = ''
        should_be += (cPickle.dumps(self.batch.options) + '\n')
        should_be += '\n'
        for _ in range(4):
            should_be += (cPickle.dumps('runs') + '\n')
            should_be += '\n'
        assert_equal(results_file.read(), should_be)
def test_batch_go(self):
    args = ['-F', 'iter_{0}.testout', '-N', '4', '-O', self.dir, '-S', 'results.testout', '--test']
    assert (self.batch.go(option_args=args) is None)
    assert_equal(self.batch.options.test, True)
    assert_equal(self.batch.options.dup, 4)
    assert_equal(self.batch.options.output_dir, self.dir)
    assert_equal(self.batch.options.output_file, 'iter_{0}.testout')
    assert_equal(self.batch.options.file_dump, True)
    assert_equal(self.batch.options.stats_file, 'results.testout')
    assert (self.batch.options.pool_size is None), 'Pool size is not None'
    assert_equal(self.batch.options.quiet, False)
    assert_equal(self.batch.data['test'], True)
    for i in range(4):
        assert os.path.isfile(((self.dir + os.sep) + 'iter_{0}.testout'.format((i + 1)))), 'Dup file {0} is missing'.format((i + 1))
    assert os.path.isfile(((self.dir + os.sep) + 'results.testout')), 'Results file is missing'
    for i in range(4):
        with open(((self.dir + os.sep) + 'iter_{0}.testout'.format((i + 1))), 'r') as dup_file:
            assert_equal(dup_file.read(), 'runs\n')
    with open(((self.dir + os.sep) + 'results.testout'), 'r') as results_file:
        should_be = 
        should_be += (cPickle.dumps(self.batch.options) + '\n')
        should_be += '\n'
        for _ in range(4):
            should_be += (cPickle.dumps('runs') + '\n')
            should_be += '\n'
        assert_equal(results_file.read(), should_be)