def setUpApplicationFor(self, action): self.diag.info("Performing " + str(action) + " set up on " + repr(self.testSuite.app)) try: action.setUpApplication(self.testSuite.app) except Exception: sys.stderr.write("Exception thrown performing " + str(action) + " set up on " + repr(self.testSuite.app) + " :\n") plugins.printException()
def getExternalDataFiles(self): try: return self.currentTest.app.extraReadFiles(self.currentTest).items() except: sys.stderr.write("WARNING - ignoring exception thrown by '" + self.currentTest.getConfigValue("config_module") + \ "' configuration while requesting extra data files, not displaying any such files") plugins.printException() return seqdict()
def makeAndGenerate(self, subDirs, getConfigValue, pageDir, *args): resourcePages = self.getResourcePages(getConfigValue) for resourcePage in resourcePages: plugins.ensureDirectoryExists(os.path.join(pageDir, resourcePage)) try: self.generateWebPages(subDirs, getConfigValue, pageDir, resourcePages, *args) except Exception: # pragma: no cover - robustness only, shouldn't be reachable sys.stderr.write("Caught exception while generating web pages :\n") plugins.printException()
def makeAndGenerate(self, subDirs, getConfigValue, pageDir, *args): resourcePages = self.getResourcePages(getConfigValue) for resourcePage in resourcePages: plugins.ensureDirectoryExists(os.path.join(pageDir, resourcePage)) try: self.generateWebPages(subDirs, getConfigValue, pageDir, resourcePages, *args) except: sys.stderr.write("Caught exception while generating web pages :\n") plugins.printException()
def run(self): while not self.terminate: self.diag.info("Waiting for a new request...") try: self.handle_request() except: # e.g. can get interrupted system call here in 'select' if we get a signal sys.stderr.write("WARNING: slave server caught exception while processing request!\n") plugins.printException() self.diag.info("Terminating slave server")
def createView(self): # Create toplevel window to show it all. self.topWindow = gtk.Window(gtk.WINDOW_TOPLEVEL) self.topWindow.set_name("Top Window") try: import stockitems stockitems.register(self.topWindow) except Exception: #pragma : no cover - should never happen plugins.printWarning("Failed to register texttest stock icons.") plugins.printException() iconFile = self.getIcon() try: self.topWindow.set_icon_from_file(iconFile) except Exception, e: plugins.printWarning("Failed to set texttest window icon.\n" + str(e), stdout=True)
def createTestSuites(self, allApps): appSuites = OrderedDict() raisedError = False for app in allApps: warningMessages = [] appGroup = [ app ] + app.extras for partApp in appGroup: try: testSuite = self.createInitialTestSuite(partApp) appSuites[partApp] = testSuite except plugins.TextTestWarning, e: warningMessages.append(partApp.rejectionMessage(str(e))) except plugins.TextTestError, e: sys.stderr.write(partApp.rejectionMessage(str(e))) raisedError = True except Exception: sys.stderr.write("Error creating test suite for " + partApp.description() + " :\n") plugins.printException()
def createView(self): # Create toplevel window to show it all. self.topWindow = gtk.Window(gtk.WINDOW_TOPLEVEL) self.topWindow.set_name("Top Window") try: import stockitems stockitems.register(self.topWindow) except: #pragma : no cover - should never happen plugins.printWarning("Failed to register texttest stock icons.") plugins.printException() self.topWindow.set_icon_from_file(self.getIcon()) self.setWindowTitle() self.topWindow.add(self.subguis[0].createView()) self.adjustSize() self.topWindow.show() self.topWindow.set_default_size(-1, -1) self.notify("TopWindow", self.topWindow) self.topWindow.connect("delete-event", self.windowClosed) return self.topWindow
warningMessages = [] appGroup = [ app ] + app.extras for partApp in appGroup: try: testSuite = self.createInitialTestSuite(partApp) appSuites[partApp] = testSuite except plugins.TextTestWarning, e: warningMessages.append(partApp.rejectionMessage(str(e))) except plugins.TextTestError, e: sys.stderr.write(partApp.rejectionMessage(str(e))) raisedError = True except KeyboardInterrupt: raise except: sys.stderr.write("Error creating test suite for " + partApp.description() + " :\n") plugins.printException() fullMsg = "".join(warningMessages) # If the whole group failed, we write to standard error, where the GUI will find it. Otherwise we just log in case anyone cares. if len(warningMessages) == len(appGroup): sys.stderr.write(fullMsg) raisedError = True else: sys.stdout.write(fullMsg) return raisedError, appSuites def notifyExit(self): # Can get called several times, protect against this... if len(self.appSuites) > 0: self.notify("Status", "Removing all temporary files ...") for app, testSuite in self.appSuites.items(): self.notify("ActionProgress")