def getReconnectState(self, test): reconnLocation = os.path.join(self.rootDirToCopy, test.getRelPath()) self.diag.info("Reconnecting to test at " + reconnLocation) if os.path.isdir(reconnLocation): return self.getReconnectStateFrom(test, reconnLocation) else: return plugins.Unrunnable(briefText="no results", freeText="No file found to load results from under " + reconnLocation)
def readState(cls, stateFile): file = open(stateFile, "rU") try: state = cls.getNewState(file) if isinstance(state, plugins.TestState): return state else: return cls.readErrorState("Incorrect type for state object.") except Exception, e: if os.path.getsize(stateFile) > 0: return cls.readErrorState("Stack info follows:\n" + str(e)) else: return plugins.Unrunnable("Results file was empty, probably the disk it resides on is full.", "Disk full?")
def readErrorState(errMsg): freeText = "Failed to read results file, possibly deprecated format. " + errMsg return plugins.Unrunnable(freeText, "read error")
def failTest(self, excString): execHosts = self.test.state.executionHosts failState = plugins.Unrunnable(freeText=excString, briefText="TEXTTEST EXCEPTION", executionHosts=execHosts) self.test.changeState(failState)