File: //opt/alt/python27/lib/python2.7/site-packages/nose/proxy.pyo
�
Z�SSc           @   sj   d  Z  d d l Z d d l m Z e j e � Z d �  Z d e f d �  �  YZ	 d e f d �  �  YZ
 d S(	   s�  
Result Proxy
------------
The result proxy wraps the result instance given to each test. It
performs two functions: enabling extended error/failure reporting
and calling plugins.
As each result event is fired, plugins are called with the same event;
however, plugins are called with the nose.case.Test instance that
wraps the actual test. So when a test fails and calls
result.addFailure(self, err), the result proxy calls
addFailure(self.test, err) for each plugin. This allows plugins to
have a single stable interface for all test types, and also to
manipulate the test object itself by setting the `test` attribute of
the nose.case.Test that they receive.
i����N(   t   Configc            sI   �  � f d �  } �  � f d �  } �  � f d �  } t  | | | | � S(   sn   Create a property that proxies attribute ``proxied_attr`` through
    the local attribute ``local_attr``.
    c            s   t  t  |  �  � � � S(   N(   t   getattr(   t   self(   t
   local_attrt   proxied_attr(    s;   /opt/alt/python27/lib/python2.7/site-packages/nose/proxy.pyt   fget   s    c            s   t  t |  �  � � | � d  S(   N(   t   setattrR   (   R   t   value(   R   R   (    s;   /opt/alt/python27/lib/python2.7/site-packages/nose/proxy.pyt   fset   s    c            s   t  t |  �  � � � d  S(   N(   t   delattrR   (   R   (   R   R   (    s;   /opt/alt/python27/lib/python2.7/site-packages/nose/proxy.pyt   fdel!   s    (   t   property(   R   R   t   docR   R   R
   (    (   R   R   s;   /opt/alt/python27/lib/python2.7/site-packages/nose/proxy.pyt   proxied_attribute   s    t   ResultProxyFactoryc           B   s#   e  Z d  Z d d � Z d �  Z RS(   sr   Factory for result proxies. Generates a ResultProxy bound to each test
    and the result passed to the test.
    c         C   s7   | d  k r t �  } n  | |  _ t |  _ d  |  _ d  S(   N(   t   NoneR    t   configt   Falset   _ResultProxyFactory__preparedt   _ResultProxyFactory__result(   R   R   (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/nose/proxy.pyt   __init__*   s
    		c         C   sw   |  j  sF t |  _  |  j j j | � } | d k	 rF | |  _ } qF n  |  j d k	 ra |  j } n  t | | d |  j �S(   s  Return a ResultProxy for the current test.
        On first call, plugins are given a chance to replace the
        result used for the remaining tests. If a plugin returns a
        value from prepareTestResult, that object will be used as the
        result for all tests.
        R   N(   R   t   TrueR   t   pluginst   prepareTestResultR   R   t   ResultProxy(   R   t   resultt   testt   plug_result(    (    s;   /opt/alt/python27/lib/python2.7/site-packages/nose/proxy.pyt   __call__1   s    		N(   t   __name__t
   __module__t   __doc__R   R   R   (    (    (    s;   /opt/alt/python27/lib/python2.7/site-packages/nose/proxy.pyR   &