Example #1
0
    def setUp(self):
        """Compile common subpipe"""
        kwargs = {
            'test': True,
            'describe_input': True,
            'describe_dependencies': True,
        }

        self.context = Context(**kwargs)
        pipe_name = 'pipe_2de0e4517ed76082dcddf66f7b218057'
        parent = p.dirname(__file__)
        pipe_file_name = p.join(parent, 'pipelines', '%s.json' % pipe_name)

        with open(pipe_file_name) as f:
            pipe_def = loads(f.read())

        pipe = parse_pipe_def(pipe_def, pipe_name)
        parent = p.dirname(p.dirname(__file__))
        pipe_file_name = p.join(parent, 'pipe2py', 'pypipelines',
                                '%s.py' % pipe_name)

        with open(pipe_file_name, 'w') as f:
            f.write(stringify_pipe(self.context, pipe, pipe_def))
            self.context.describe_input = False
            self.context.describe_dependencies = False
Example #2
0
 def _load(self, pipe_def, pipe_name, value=0, check=1):
     pipe = parse_pipe_def(pipe_def, pipe_name)
     pipeline = list(build_pipeline(self.context, pipe))
     length = len(pipeline)
     compared = cmp(length, value)
     self.assertEqual(compared, check)
     return pipeline
Example #3
0
    def setUp(self):
        """Compile common subpipe"""
        kwargs = {
            'test': True,
            'describe_input': True,
            'describe_dependencies': True,
        }

        self.context = Context(**kwargs)
        pipe_name = 'pipe_2de0e4517ed76082dcddf66f7b218057'
        parent = p.dirname(__file__)
        pipe_file_name = p.join(parent, 'pipelines', '%s.json' % pipe_name)

        with open(pipe_file_name) as f:
            pipe_def = loads(f.read())

        pipe = parse_pipe_def(pipe_def, pipe_name)
        parent = p.dirname(p.dirname(__file__))
        pipe_file_name = p.join(
            parent, 'pipe2py', 'pypipelines', '%s.py' % pipe_name)

        with open(pipe_file_name, 'w') as f:
            f.write(stringify_pipe(self.context, pipe, pipe_def))
            self.context.describe_input = False
            self.context.describe_dependencies = False
Example #4
0
    def setUp(self):
        """Compile common subpipe"""
        self.context = Context(test=True)
        pipe_name = 'pipe_2de0e4517ed76082dcddf66f7b218057'
        pipe_def = self._get_pipe_def(pipe_name)
        pipe = parse_pipe_def(pipe_def, pipe_name)

        with open("%s.py" % pipe_name, "w") as f:
            f.write(stringify_pipe(self.context, pipe))
Example #5
0
    def _get_pipeline(self, pipe_name):
        try:
            module = import_module('tests.pypipelines.%s' % pipe_name)
        except ImportError:
            parent = p.dirname(__file__)
            pipe_file_name = p.join(parent, 'pipelines', '%s.json' % pipe_name)

            with open(pipe_file_name) as f:
                pipe_def = loads(f.read())

            pipe = parse_pipe_def(pipe_def, pipe_name)
            pipeline = build_pipeline(self.context, pipe, pipe_def)
        else:
            pipe_generator = getattr(module, pipe_name)
            pipeline = pipe_generator(self.context)

        return list(pipeline)
Example #6
0
    def _get_pipeline(self, pipe_name):
        try:
            module = import_module('tests.pypipelines.%s' % pipe_name)
        except ImportError:
            parent = p.dirname(__file__)
            pipe_file_name = p.join(parent, 'pipelines', '%s.json' % pipe_name)

            with open(pipe_file_name) as f:
                pipe_def = loads(f.read())

            pipe = parse_pipe_def(pipe_def, pipe_name)
            pipeline = build_pipeline(self.context, pipe, pipe_def)
        else:
            pipe_generator = getattr(module, pipe_name)
            pipeline = pipe_generator(self.context)

        return list(pipeline)