def test_lamp_simple_print(self):
     lamp = Communicate(self.lampExecutable, self.lampPrompt, self.lampExitCommand)
     
     output,errors = lamp.communicate('print, "%s"'%self.stringToPrint, waitTimeForTheCommandToGiveOutput=0.2)
     
     self.assertEqual(output.strip(),self.stringToPrint)
     self.assertEqual(errors.strip(),"")
     
     lamp.exit();
 def test_lamp_print_with_process_relaunch(self):
     lamp = Communicate(self.lampExecutable, self.lampPrompt, self.lampExitCommand)
     #time.sleep(0.2)
     output,errors = lamp.communicate('print, "%s"'%self.stringToPrint, waitTimeForTheCommandToGiveOutput=0.2)
     
     self.assertEqual(output.strip(),self.stringToPrint)
     self.assertEqual(errors.strip(),"")
     
     lamp.exit();
     
     output,errors = lamp.communicate('print, "%s"'%self.stringToPrint, waitTimeForTheCommandToGiveOutput=0.2)
     
     self.assertEqual(output.strip(),self.stringToPrint)
     self.assertEqual(errors.strip(),"")
     
     lamp.exit();
    def test_python_simple_print(self):
        '''
        To run just this test:
        python -m unittest -q testCommunicate.TestCommunicate.test_python_simple_print
        '''

        pyshell = Communicate(self.pythonExecutable, self.pythonPrompt, self.pythonExitCommand)
        time.sleep(0.2)
        output,errors = pyshell.communicate('print "%s"'%self.stringToPrint, waitTimeForTheCommandToGiveOutput=0)
        
        print 'O', output
        print 'E', errors
        
        self.assertEqual(output.strip(),self.stringToPrint)
        self.assertEqual(errors.strip(),"")
        
        pyshell.exit();