コード例 #1
0
ファイル: gevent.py プロジェクト: usteiner9/pyvows
        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())
コード例 #2
0
ファイル: gevent.py プロジェクト: coreypobrien/pyvows
        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())
コード例 #3
0
ファイル: gevent.py プロジェクト: Zearin/pyvows
        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())
コード例 #4
0
 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
コード例 #5
0
ファイル: gevent.py プロジェクト: ricklupton/pyvows
 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