def test_read_pidfile_0(self): self.unlink(self.pname) target.write_pidfile(self.pname, 30) ret = target.read_pidfile(self.pname) self.assertEquals('30', ret) self.unlink(self.pname)
def test_write_pidfile_1(self): self.unlink(self.pname) ret = target.write_pidfile(self.pname, 10) ret = target.write_pidfile(self.pname, 20) fp = open(self.pname, 'r') ret = fp.read() self.assertEquals('20', ret) self.unlink(self.pname)
def _setdaemon(self): if self.opts.daemon is True: pid = os.getpid() try: write_pidfile(self.opts.pidfile, pid) except Exception: self.logger.error('Could not create process file. - file=%s' % self.opts.pidfile) raise e self.logger.info('The process file was created. - file=%s' % self.opts.pidfile) return True
def test_write_pidfile_0(self): self.unlink(self.pname) ret = target.write_pidfile(self.pname, 12345) self.assertTrue(ret) self.unlink(self.pname)