def run(self): self.args = self._parser.parse_args() if self.args.pysamllog: root_logger.addHandler(memoryhandler) root_logger.setLevel(logging.DEBUG) if self.args.metadata: return self.make_meta() elif self.args.list: return self.list_operations() elif self.args.oper == "check": return self.verify_metadata() else: if not self.args.oper: raise Exception("Missing test case specification") self.args.oper = self.args.oper.strip("'") self.args.oper = self.args.oper.strip('"') self.setup() try: oper = self.operations.OPERATIONS[self.args.oper] except KeyError: if self.tests: try: oper = self.tests.OPERATIONS[self.args.oper] except ValueError: print >> sys.stderr, "Undefined testcase " + self.args.oper return else: print >> sys.stderr, "Undefined testcase " + self.args.oper return if self.args.pretty: pp = pprint.PrettyPrinter(indent=4) else: pp = None logger.info("Starting conversation") conv = Conversation(self.idp, self.idp_config, self.interactions, self.json_config, check_factory=self.check_factory, entity_id=self.entity_id, constraints=self.constraints, commandlineargs=self.args) try: conv.do_sequence_and_tests(oper["sequence"], oper["tests"]) self.test_log = conv.test_output tsum = self.test_summation(self.args.oper) err = None except CheckError, err: self.test_log = conv.test_output tsum = self.test_summation(self.args.oper)
def run(self): self.args = self._parser.parse_args() if self.args.pysamllog: root_logger.addHandler(memoryhandler) root_logger.setLevel(logging.DEBUG) if self.args.metadata: return self.make_meta() elif self.args.list: return self.list_operations() elif self.args.oper == "check": return self.verify_metadata() else: if not self.args.oper: raise Exception("Missing test case specification") self.args.oper = self.args.oper.strip("'") self.args.oper = self.args.oper.strip('"') self.setup() try: oper = self.operations.OPERATIONS[self.args.oper] except KeyError: if self.tests: try: oper = self.tests.OPERATIONS[self.args.oper] except ValueError: print >> sys.stderr, "Undefined testcase " + self.args.oper return else: print >> sys.stderr, "Undefined testcase " + self.args.oper return if self.args.pretty: pp = pprint.PrettyPrinter(indent=4) else: pp = None logger.info("Starting conversation") conv = Conversation(self.idp, self.idp_config, self.interactions, self.json_config, check_factory=self.check_factory, entity_id=self.entity_id, constraints=self.constraints, commandlineargs = self.args) try: conv.do_sequence_and_tests(oper["sequence"], oper["tests"]) self.test_log = conv.test_output tsum = self.test_summation(self.args.oper) err = None except CheckError, err: self.test_log = conv.test_output tsum = self.test_summation(self.args.oper)
def run(self): self.args = self._parser.parse_args() if self.args.pysamllog: root_logger.addHandler(memoryhandler) root_logger.setLevel(logging.DEBUG) if self.args.metadata: return self.make_meta() elif self.args.list: return self.list_operations() elif self.args.oper == "check": return self.verify_metadata() else: if not self.args.oper: raise Exception("Missing test case specification") self.args.oper = self.args.oper.strip("'") self.args.oper = self.args.oper.strip('"') self.setup() try: oper = self.operations.OPERATIONS[self.args.oper] except KeyError: if self.tests: try: oper = self.tests.OPERATIONS[self.args.oper] except ValueError: print("Undefined testcase " + self.args.oper, file=sys.stderr) return else: print("Undefined testcase " + self.args.oper, file=sys.stderr) return if self.args.pretty: pp = pprint.PrettyPrinter(indent=4) else: pp = None logger.info("Starting conversation") conv = Conversation(self.idp, self.idp_config, self.interactions, self.json_config, check_factory=self.check_factory, entity_id=self.entity_id, constraints=self.constraints, commandlineargs = self.args) try: conv.do_sequence_and_tests(oper["sequence"], oper["tests"]) self.test_log = conv.test_output tsum = self.test_summation(self.args.oper) err = None except CheckError as err: self.test_log = conv.test_output tsum = self.test_summation(self.args.oper) except FatalError as err: if conv: self.test_log = conv.test_output self.test_log.append(exception_trace("RUN", err)) else: self.test_log = exception_trace("RUN", err) tsum = self.test_summation(self.args.oper) except Exception as err: if conv: conv.test_output.append({"status": CRITICAL, "name": "test driver error", "id": "critial exception"}) self.test_log = conv.test_output self.test_log.append(exception_trace("RUN", err)) else: self.test_log = exception_trace("RUN", err) tsum = self.test_summation(self.args.oper) logger.error("Unexpected exception in test driver %s", traceback.format_exception(*sys.exc_info())) if pp: pp.pprint(tsum) else: print(json.dumps(tsum), file=sys.stdout) if tsum["status"] > 1 or self.args.debug or err: self.output_log(memoryhandler, streamhandler)
def run(self): self.args = self._parser.parse_args() if self.args.pysamllog: root_logger.addHandler(memoryhandler) root_logger.setLevel(logging.DEBUG) if self.args.metadata: return self.make_meta() elif self.args.list: return self.list_operations() elif self.args.oper == "check": return self.verify_metadata() else: if not self.args.oper: raise Exception("Missing test case specification") self.args.oper = self.args.oper.strip("'") self.args.oper = self.args.oper.strip('"') self.setup() try: oper = self.operations.OPERATIONS[self.args.oper] except KeyError: if self.tests: try: oper = self.tests.OPERATIONS[self.args.oper] except ValueError: print("Undefined testcase " + self.args.oper, file=sys.stderr) return else: print("Undefined testcase " + self.args.oper, file=sys.stderr) return if self.args.pretty: pp = pprint.PrettyPrinter(indent=4) else: pp = None logger.info("Starting conversation") conv = Conversation(self.idp, self.idp_config, self.interactions, self.json_config, check_factory=self.check_factory, entity_id=self.entity_id, constraints=self.constraints, commandlineargs=self.args) try: conv.do_sequence_and_tests(oper["sequence"], oper["tests"]) self.test_log = conv.test_output tsum = self.test_summation(self.args.oper) err = None except CheckError as err: self.test_log = conv.test_output tsum = self.test_summation(self.args.oper) except FatalError as err: if conv: self.test_log = conv.test_output self.test_log.append(exception_trace("RUN", err)) else: self.test_log = exception_trace("RUN", err) tsum = self.test_summation(self.args.oper) except Exception as err: if conv: conv.test_output.append({ "status": CRITICAL, "name": "test driver error", "id": "critial exception" }) self.test_log = conv.test_output self.test_log.append(exception_trace("RUN", err)) else: self.test_log = exception_trace("RUN", err) tsum = self.test_summation(self.args.oper) logger.error("Unexpected exception in test driver %s", traceback.format_exception(*sys.exc_info())) if pp: pp.pprint(tsum) else: print(json.dumps(tsum), file=sys.stdout) if tsum["status"] > 1 or self.args.debug or err: self.output_log(memoryhandler, streamhandler)