def _setUp(self): pidfile = pidfile_path( "codebrowse", use_config=LayerProcessController.appserver_config) pid = get_pid_from_file(pidfile) if pid is not None: warnings.warn( "Attempt to start LoggerheadFixture with an existing " "instance (%d) running in %s." % (pid, pidfile)) kill_by_pidfile(pidfile) self.logfile = os.path.join(config.codebrowse.log_folder, "debug.log") remove_if_exists(self.logfile) self.addCleanup(kill_by_pidfile, pidfile) run_script( os.path.join("scripts", "start-loggerhead.py"), ["--daemon"], # The testrunner-appserver config provides the correct # openid_provider_root URL. extra_env={"LPCONFIG": BaseLayer.appserver_config_name}) self._waitForStartup()
def match(self, fixture): pid = get_pid_from_file(fixture.pidfile) if pid is None or not exists("/proc/%d" % pid): return Mismatch("Fixture %r is not running." % fixture)
def _read_pid(self): return get_pid_from_file(self.pidfile)