def addLog(self, name): assert self.started # addLog before stepStarted won't notify watchers logfilename = self.build.generateLogfileName(self.name, name) log = LogFile(self, name, logfilename) log.logMaxSize = self.build.builder.logMaxSize log.logMaxTailSize = self.build.builder.logMaxTailSize log.compressMethod = self.build.builder.logCompressionMethod self.logs.append(log) for w in self.watchers: receiver = w.logStarted(self.build, self, log) if receiver: log.subscribe(receiver, True) d = log.waitUntilFinished() d.addCallback(lambda log: log.unsubscribe(receiver)) d = log.waitUntilFinished() d.addCallback(self.logFinished) return log
def setupStatus(self, name=None, text=None, has_content=False, content_type=None, html_log=True): st = self.build_step_status = mock.Mock(BuildStepStatus) self.logs = [] st.getLogs = lambda: self.logs if name is None: return st step = self.setupBuildStepStatus() log = HTMLLogFile(step, "example", "test file", "test html") if html_log \ else LogFile(step, "example", "test file") log.getName = lambda: name log.hasContents = lambda: has_content log.content_type = content_type log.getText = lambda: text self.logs.append(log) return st