Your IP : 216.73.216.213
�
U� � @ sm d Z d d l Z d d l m Z e j e � Z d d � Z Gd d � d e � Z Gd d � d e � Z
d S)
a�
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.
� N)�Configc sR � � f d d � } � � f d d � } � � f d d � } t | | | | � S)znCreate a property that proxies attribute ``proxied_attr`` through
the local attribute ``local_attr``.
c s t t | � � � � S)N)�getattr)�self)�
local_attr�proxied_attr� �;/opt/alt/python35/lib/python3.5/site-packages/nose/proxy.py�fget s zproxied_attribute.<locals>.fgetc s t t | � � � | � d S)N)�setattrr )r �value)r r r r �fset s zproxied_attribute.<locals>.fsetc s t t | � � � � d S)N)�delattrr )r )r r r r �fdel! s zproxied_attribute.<locals>.fdel)�property)r r �docr r r r )r r r �proxied_attribute s r c @ s1 e Z d Z d Z d d d � Z d d � Z d S)�ResultProxyFactoryzrFactory for result proxies. Generates a ResultProxy bound to each test
and the result passed to the test.
Nc C s4 | d k r t � } | | _ d | _ d | _ d S)NF)r �config�_ResultProxyFactory__prepared�_ResultProxyFactory__result)r r r r r �__init__* s
zResultProxyFactory.__init__c C sn | j s@ d | _ | j j j | � } | d k r@ | | _ } | j d k rX | j } t | | d | j �S)a 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.
TNr )r r �pluginsZprepareTestResultr �ResultProxy)r �result�testZplug_resultr r r �__call__1 s
zResultProxyFactory.__call__)�__name__�
__module__�__qualname__�__doc__r r r r r r r &