Example #1
0
 def test_ExecError(self):
     doc = ISE(SEQ(ACTION(tools.getMockActionCmd(ACTION_RC_KO,
                                                 "Message2StdOut",
                                                 "Message2StdErr"),
                          id="a"),
                   ACTION(tools.getMockActionCmd(ACTION_RC_OK,
                                                 "Message2StdOut",
                                                 "Message2StdErr"),
                          id="b"),
                   desc="test_ExecWarning"))
     xml = lxml.etree.tostring(doc, pretty_print=True)
     process = Popen(["sequencer", "seqexec", "--report", "all"],
                     stdin=PIPE,
                     stdout=PIPE,
                     stderr=PIPE,
                     env={'PATH':BIN_PATH,
                          'PYTHONPATH':PYTHON_PATH}
                     )
     (output, error) = process.communicate(xml)
     print "Output: %s\nError: %s" % (output, error)
     self.assertActionsInModel(output, ids=["a", "b"])
     self.assertExecutedActions(output, ids=["a"])
     self.assertErrors(output, ids=["a"])
     self.assertUnexecutedActions(output, ids=["b"])
     self.assertEquals(process.returncode, ACTION_RC_KO)
Example #2
0
 def test_NoExec(self):
     doc = ISE(PAR(ACTION(tools.getMockActionCmd(ACTION_RC_OK,
                                                 "Message2StdOut",
                                                 "Message2StdErr"),
                          id="a")))
     xml = lxml.etree.tostring(doc, pretty_print=True)
     process = Popen(["sequencer", "seqexec", "--doexec=no",
                      "--report", "all"],
                     stdin=PIPE,
                     stdout=PIPE,
                     stderr=PIPE,
                     env={'PATH':BIN_PATH,
                          'PYTHONPATH':PYTHON_PATH}
                     )
     (output, error) = process.communicate(xml)
     print "Output: %s\nError: %s" % (output, error)
     self.assertActionsInModel(output, ids=["a"])
Example #3
0
 def test_GraphTo(self):
     doc = ISE(PAR(ACTION(tools.getMockActionCmd(ACTION_RC_OK,
                                                 "Message2StdOut",
                                                 "Message2StdErr"),
                          id="a")))
     xml = lxml.etree.tostring(doc, pretty_print=True)
     tmpfile = tempfile.NamedTemporaryFile(suffix=".dot.xml",
                                           prefix=self.__class__.__name__ + "-",
                                           delete=True)
     filename = tmpfile.name
     process = Popen(["sequencer", "seqexec",
                      "--actionsgraphto=%s"%filename],
                     stdin=PIPE,
                     stdout=PIPE,
                     stderr=PIPE,
                     env={'PATH':BIN_PATH,
                          'PYTHONPATH':PYTHON_PATH}
                     )
     (output, error) = process.communicate(xml)
     print "Output: %s\nError: %s" % (output, error)
     self.assertTrue(os.path.exists(filename))
     self.assertTrue(os.stat(filename).st_size > 0)