def _run_setup_and_topic(ctx_obj, index): # If we're already mid-skip, don't run anything if skipReason: raise skipReason # Run setup function try: ctx_obj.setup() except Exception: raise VowsTopicError('setup', sys.exc_info()) # Find & run topic function if not hasattr(ctx_obj, 'topic'): # ctx_obj has no topic return ctx_obj._get_first_available_topic(index) try: topic_func = ctx_obj.topic topic_list = get_topics_for(topic_func, ctx_obj) start_time = time.time() if topic_func is None: return None topic = topic_func(*topic_list) ctx_result['topic_elapsed'] = elapsed(start_time) return topic except SkipTest: raise except Exception: raise VowsTopicError('topic', sys.exc_info())
def _run_setup_and_topic(ctx_obj, index): # Run setup function try: ctx_obj.setup() except Exception as e: raise VowsTopicError('setup', sys.exc_info()) # Find & run topic function if not hasattr(ctx_obj, 'topic'): # ctx_obj has no topic return ctx_obj._get_first_available_topic(index) try: topic_func = ctx_obj.topic topic_list = get_topics_for(topic_func, ctx_obj) start_time = time.time() topic = topic_func(*topic_list) ctx_result['topic_elapsed'] = elapsed(start_time) return topic except Exception as e: raise VowsTopicError('topic', sys.exc_info())
def _run_setup_and_topic(ctx_obj): try: ctx_obj.setup() except Exception as e: topic = e topic.error = ctx_obj.topic_error = ('setup', sys.exc_info()) else: # setup() had no errors topic = None if not hasattr(ctx_obj, 'topic'): # ctx_obj has no topic topic = ctx_obj._get_first_available_topic(index) else: start_time = time.time() try: topic_func = getattr(ctx_obj, 'topic') topic_list = get_topics_for(topic_func, ctx_obj) topic = topic_func(*topic_list) except Exception as e: topic = e topic.error = ctx_obj.topic_error = sys.exc_info() ctx_result['topic_elapsed'] = elapsed(start_time) finally: return topic