def setUp(self):
     super(SimplePipeLineTest, self).setUp()
     self.templates = TemplateLookup(directories=[os.path.join(self.datadir, 'simple-pipeline')])
     self.output = tempfile.NamedTemporaryFile('w').name
     self.signer = tempfile.NamedTemporaryFile('w').name
     self.signer_template = self.templates.get_template('signer.fd')
     self.validator = tempfile.NamedTemporaryFile('w').name
     self.validator_template = self.templates.get_template('validator.fd')
     self.md_signer = MDRepository()
     self.md_validator = MDRepository()
     with open(self.signer, "w") as fd:
         fd.write(self.signer_template.render(ctx=self))
     with open(self.validator, "w") as fd:
         fd.write(self.validator_template.render(ctx=self))
     self.signer_result = plumbing(self.signer).process(self.md_signer, state={'batch': True, 'stats': {}})
     self.validator_result = plumbing(self.validator).process(self.md_validator, state={'batch': True, 'stats': {}})
Beispiel #2
0
 def run_pipeline(self, pl_name, ctx=dict(), md=MDRepository()):
     pipeline = tempfile.NamedTemporaryFile('w').name
     template = self.templates.get_template(pl_name)
     with open(pipeline, "w") as fd:
         fd.write(template.render(ctx=ctx))
     res = plumbing(pipeline).process(md, state={'batch': True, 'stats': {}})
     os.unlink(pipeline)
     return res, md, ctx