def _startProcess(self, command, env): """Start OpenOffice.org process""" for i in range(5): self.stop() waitStopDaemon(self, self.timeout) self.process = Popen(command, close_fds=True, env=env) if not waitStartDaemon(self, self.timeout): continue if self._testOpenOffice(self.hostname, self.port): return
def stop(self): """Stop the process""" if hasattr(self, 'process') and self.status(): process_pid = self.process.pid logger.debug("Stop Pid - %s" % process_pid) try: self.process.terminate() waitStopDaemon(self, self.timeout) finally: if pid_exists(process_pid) or self.status(): Process(process_pid).kill() delattr(self, "process")
def testOpenOfficeStop(self): """Test if the stop method works correctly""" self.openoffice.stop() waitStopDaemon(self.openoffice) self.assertEquals(self.openoffice.status(), False)