Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/_pytest/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/_pytest/__pycache__/unittest.cpython-37.pyc

B

C$�X!�@s�dZddlmZddlZddlZddlZddlZddlm	Z	ddl
mZdd�ZGdd	�d	ej
�ZGd
d�dej�Zejdd
�dd��Zejdd�dd��Zgfdd�ZdS)z> discovery and running of std-library "unittest" style tests. �)�absolute_importN)�transfer_markers)�
MarkEvaluatorcCs<yt|tjdj�sdSWntk
r.dSXt||d�S)N�unittest)�parent)�
issubclass�sys�modules�TestCase�	Exception�UnitTestCase)Z	collector�name�obj�r�A/opt/alt/python37/lib/python3.7/site-packages/_pytest/unittest.py�pytest_pycollect_makeitemsrcs(eZdZdZ�fdd�Zdd�Z�ZS)rTcs`|j}t|dd�rdSt|dd�}|dk	r0|�t|dd�}|dk	rN|�|�tt|���dS)N�__unittest_skip__FZ
setUpClassZ
tearDownClass)r�getattrZaddfinalizer�superr�setup)�self�clsr�teardown)�	__class__rrrs
zUnitTestCase.setupccs�ddlm}|j}t|dd�s"dS|jjj|dd�|�}|�tj	�j}d}xX|�
|j�D]H}t|j|�}t|dd�sxqZt|d|�}t|||�t||d�Vd}qZW|s�t|jd	d�}	|	dk	r�t
j�d
d�}
|
dks�|	|
jjkr�td	|d�VdS)Nr)�
TestLoaderZ__test__T)rFZim_func)r�runTestztwisted.trial.unittest)rrrrZsessionZ_fixturemanagerZparsefactoriesZ	getparent�pytest�ModuleZgetTestCaseNamesr�TestCaseFunctionrr	�getr
r)rrr�loader�moduleZfoundsomethingr
�x�funcobj�runtest�utrrr�collect*s,zUnitTestCase.collect)�__name__�
__module__�__qualname__Z
nofuncargsrr&�
__classcell__rr)rrrsrc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zd!dd�Zd"dd�Z
dd�Zdd�Zdd�Zdd�Zdd �ZdS)#rNcCsZ|j�|j�|_|��t|j|j�|_t|jd�rB|j�|j�t|d�rV|j	�
�dS)N�setup_method�_request)rrr
�	_testcase�_fix_unittest_skip_decoratorr�_obj�hasattrr+r,Z
_fillfixtures)rrrrrGs
zTestCaseFunction.setupcCs"tjddkrt|jd|j�dS)aO
        The @unittest.skip decorator calls functools.wraps(self._testcase)
        The call to functools.wraps() fails unless self._testcase
        has a __name__ attribute. This is usually automatically supplied
        if the test is a function or method, but we need to add manually
        here.

        See issue #1169
        r�r'N)r�version_info�setattrr-r
)rrrrr.Ps
z-TestCaseFunction._fix_unittest_skip_decoratorcCs*t|jd�r|j�|j�d|_d|_dS)N�teardown_method)r0r-r4r/)rrrrr]szTestCaseFunction.teardowncCsdS)Nr)r�testcaserrr�	startTestdszTestCaseFunction.startTestcCs�t|d|�}ytj�|�}Wn�tk
r�ypy.tj|�}|�dd�tj	d�
|�dd�Wn<tj	jtfk
rz�Yn tj	d|fdd�YnXWn6tk
r��Yn"tj	jk
r�tj��}YnXYnX|j
�dg��|�dS)	N�_rawexcinforzCNOTE: Incompatible Exception Representation, displaying natively:

�F)Zpytracez8ERROR: Unknown Incompatible Exception representation:
%r�_excinfo)r�_pytest�_codeZ
ExceptionInfo�	TypeError�	traceback�format_exception�insertrZfail�joinr�KeyboardInterrupt�__dict__�
setdefault�append)r�
rawexcinfo�excinfo�lrrr�_addexcinfogs&
zTestCaseFunction._addexcinfocCs|�|�dS)N)rH)rr5rErrr�addError~szTestCaseFunction.addErrorcCs|�|�dS)N)rH)rr5rErrr�
addFailure�szTestCaseFunction.addFailurecCsNyt�|�Wn:tjjk
rHt|d�|_d|j_|�t���YnXdS)NZSkipTestT)	r�skiprrZ	_evalskip�resultrHr�exc_info)rr5�reasonrrr�addSkip�szTestCaseFunction.addSkipr8cCs>yt�t|��Wn&tjjk
r8|�t���YnXdS)N)rZxfail�strrrHrrM)rr5rErNrrr�addExpectedFailure�sz#TestCaseFunction.addExpectedFailurecCs
||_dS)N)Z_unexpectedsuccess)rr5rNrrr�addUnexpectedSuccess�sz%TestCaseFunction.addUnexpectedSuccesscCsdS)Nr)rr5rrr�
addSuccess�szTestCaseFunction.addSuccesscCsdS)Nr)rr5rrr�stopTest�szTestCaseFunction.stopTestcCs�t|j|jj�}t|jjdd�s,t|dd�r�t|jjdd�pFt|dd�}y|j�||j|�Wn2tk
r�tjddkr~�|j�||�YnXdSdS)NrFZ__unittest_skip_why__r8rr1T)rr-Z_testMethodNamerZ_addSkipr<rr2)rZ
testMethodZskip_whyrrr�_handle_skip�szTestCaseFunction._handle_skipcCs:|jj�d�dkr |j|d�n|��r,dS|j��dS)NZ	pdbinvoke)rL)�configZ
pluginmanagerZ
get_pluginr-rU�debug)rrrrr$�s
zTestCaseFunction.runtestcCs,tj�||�|j�dd��}|r(||_dS)NcSs|jj�d�S)NZ
__unittest)�frame�	f_globalsr)r"rrr�<lambda>��z2TestCaseFunction._prunetraceback.<locals>.<lambda>)r�Function�_prunetracebackr=�filter)rrFr=rrrr]�s

z TestCaseFunction._prunetraceback)r8)r8)r'r(r)r9rr.rr6rHrIrJrOrQrRrSrTrUr$r]rrrrrDs 	


	rT)ZtryfirstcCs@t|t�r<|jr<|j�d�|_y|`Wntk
r:YnXdS)Nr)�
isinstancerr9�poprFrL�AttributeError)�item�callrrr�pytest_runtest_makereport�s
rd)Zhookwrapperc#s\t|t�rRdtjkrRtjd}|jj�t�d�fdd�	}||j_dV�|j_ndVdS)Nztwisted.trial.unittestztwisted.python.failurecsn|dkrt��|_n|dkr$t|�}|||f|_y�|||||d�Wn"tk
rh�||||�YnXdS)N)�captureVars)rrMr7�typer<)r�	exc_value�exc_type�exc_tbre)�Failure__init__rr�excstore�s
z)pytest_runtest_protocol.<locals>.excstore)NNNN)r_rrr	ZFailure�__init__�(check_testcase_implements_trial_reporter)rbr%rkr)rjr�pytest_runtest_protocol�s




rncCs8|rdSddlm}ddlm}|t|�|�d�dS)Nr)�classImplements)�	IReporter�)Zzope.interfaceroZtwisted.trial.itrialrprrD)�donerorprrrrm�s
rm)�__doc__�
__future__rrr=rZ
_pytest._coder:Z_pytest.pythonrZ_pytest.skippingrrZClassrr\rZhookimplrdrnrmrrrr�<module>s+x