Your IP : 216.73.216.196


Current Path : /opt/alt/python27/lib/python2.7/site-packages/_pytest/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyo

�
�mYc@`s�dZddlmZmZmZddlZddlZddlZddlZddl	m
Z
ddlmZm
Z
ddlmZmZd�Zd�Zd	ejfd
��YZdd�Zee_d
dd��YZe
de�d��Ze
de�d��Zd�Zd�Ze
de�d��Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$dS(s/ support for skip/xfail functions and markers. i(tabsolute_importtdivisiontprint_functionN(thookimpl(tMarkInfot
MarkDecorator(tfailtskipc
C`sT|jd�}|jddddddtdd	�|jd
ddtdd
�dS(Ntgenerals
--runxfailtactiont
store_truetdesttrunxfailtdefaultthelps'run tests even if they are marked xfailtxfail_stricts\default for the strict parameter of xfail markers when not given explicitly (default: False)ttypetbool(tgetgroupt	addoptiontFalsetaddini(tparsertgroup((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pytpytest_addoption
sc`s�|jjrbddl��j�|jj��fd��d�}t|_t�d|�n|j	dd�|j	dd�|j	dd�dS(	Nic`st�d��S(Ntxfail(tsetattr((toldtpytest(sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyt<lambda>tc_`sdS(N((targstkwargs((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pytnop!sRtmarkerss�skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test.sskipif(condition): skip the given test function if eval(condition) results in a True value.  Evaluation happens within the module global context. Example: skipif('sys.platform == "win32"') skips the test if we are on the win32 platform. see http://pytest.org/latest/skipping.htmls�xfail(condition, reason=None, run=True, raises=None, strict=False): mark the test function as an expected failure if eval(condition) has a True value. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See http://pytest.org/latest/skipping.html(
toptionRRRt_cleanuptappendtXFailedt	ExceptionRtaddinivalue_line(tconfigR!((RRsA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pytpytest_configures						R&cB`seZdZRS(s0 raised from an explicit call to pytest.xfail() (t__name__t
__module__t__doc__(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyR&>sRcC`st}t|��dS(sB xfail an executing test or setup functions with the given reason.N(tTrueR&(treasont__tracebackhide__((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyRBst
MarkEvaluatorcB`sqeZd�Zed��Zd�ZeZd�Zd�Zd�Z	d�Z
d�Zd
d�Z
d	�ZRS(cC`s||_||_dS(N(titemtname(tselfR2R3((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyt__init__Ls	cC`s|jjj|j�S(N(R2tkeywordstgetR3(R4((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pytholderPscC`s
t|j�S(N(RR8(R4((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyt__bool__TscC`st|d�S(Ntexc(thasattr(R4((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pytwasvalidXscC`s'|jd�}|sdSt||�S(Ntraises(R7t
isinstance(R4R:R=((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pytinvalidraise[scC`s�y|j�SWn�tk
r�tj�|_t|jdt�rrd|jdjddg}|jd�nt	j
|jd �}td|j|j
dj|�fd	t�nXdS(
Nit it^sSyntaxError: invalid syntaxis(Error evaluating %r expression
    %s
%ss
tpytrace(t_istrueR'tsystexc_infoR:R>tSyntaxErrortoffsetR%t	tracebacktformat_exception_onlyRR3texprtjoinR(R4tmsg((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pytistrueas
cC`sPitd6td6|jjd6}t|jd�rL|j|jjj�n|S(NtosRDR)tobj(RNRDR2R)R;tupdateROt__globals__(R4td((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyt_getglobalsqs!c	C`stt|d�r|jS|jrd|jjs=d|jjkrXt|_t|jdd�pg|jjg}x�|D]�\}}}d|kr�|df}nx�|D]�}||_	t
|tjj
�r�|j�}t|jj||�}n+d|kr
d}t|�nt|�}|r�t|_|jdd�|_||_	|jSq�WqqWqdt|_nt|dt�S(Ntresultt	conditiont_marksR/sDyou need to specify reason=STRING when using booleans as conditions.(R;RTR8RR RtgetattrtNonetmarkRJR>tpytbuiltint_basestringRStcached_evalR2R)RRR.R7R/(	R4tmarkst_RR RJRRRTRL((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyRCws4		
	
		cC`s|jjj||�S(N(R8R R7(R4tattrR
((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyR7�scC`sUt|dd�p!|jdd�}|sQt|d�s=dSdt|j�Sn|S(NR/RJRscondition: (RWRXR7R;tstrRJ(R4texpl((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pytgetexplanation�s$N(R+R,R5tpropertyR8R9t__nonzero__R<R?RMRSRCRXR7Rc(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyR1Ks							#ttryfirstcC`s�|jjd�}t|ttf�rat|d�}|j�ra||_t|j	��qan|jjd�}t|ttf�r�t
|_d|jkr�t|jd�q�|jr�t|jd�q�td�nt|d�|_
t|�dS(NtskipifRR/isunconditional skipR(R6R7R>RRR1RMt	_evalskipRRcR.R Rt
_evalxfailtcheck_xfail_no_run(R2tskipif_infoteval_skipift	skip_info((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pytpytest_runtest_setup�s 			
thookwrappercc`s7t|�dV}|jdk}|r3t|�ndS(N(RjtexcinfoRXtcheck_strict_xfail(t
pyfuncitemtoutcometpassed((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pytpytest_pyfunc_call�s

cC`sW|jjjsS|j}|j�rS|jdt�sPtd|j��qPqSndS(scheck xfail(run=False)truns	[NOTRUN] N(	R)R#RRiRMR7R.RRc(R2t	evalxfail((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyRj�s
	cC`so|j}|j�rk|jjd�}|jd|�}|rk|`|j�}td|dt�qkndS(s3check xfail(strict=True) for the given PASSING testRtstricts[XPASS(strict)] RBN(RiRMR)tgetiniR7RcRR(RrRwtstrict_defaulttis_strict_xfailtexplanation((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyRq�s	c
c`s^dV}|j�}t|dd�}t|dd�}t|d�r�|jdkr�ddlm}|jr�dj|j�|_	n	d|_	|�r�d	|_
qZd
|_
|j	|_n�|jj
jr�n�|jr|jjtj�rd|jjj|_d|_
nL|r�|jr�|j�r�|j�r�|jr{|j|jj�r`d	|_
q�d|_
|j�|_qZ|jdkrZ|jjd
�}|jd|�}|j�}	|r�d	|_
dj|	�|_	q�d
|_
|	|_qZnd|dk	rZ|jrZt|j	�tkrZ|j	\}
}}|jd \}
}|
||f|_	ndS(NRiRht_unexpectedsuccesstcalli(t)_is_unittest_unexpected_success_a_failuresUnexpected success: {0}sUnexpected successtfailedRtsreason: tskippedRRxs[XPASS(strict)] {0}i(t
get_resultRWRXR;twhent_pytest.compatRR}tformattlongreprRstwasxfailR)R#RRpt
errisinstanceRR'tvalueRLR�R<RMR?RcRyR7Rttupletlocation(
R2R~RstrepRwtevalskipRRzR{R|tfilenametlineR/((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pytpytest_runtest_makereport�sL								*cC`sFt|d�rB|jrd	S|jrBddditd6ffSndS(
NR�txfailedtxRtxpassedtXtXPASStyellow(R�R�R(R;R�RtR.(treport((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pytpytest_report_teststatuss
		cC`s(|}|jsdSg}x�|jD]�}|dkrEt||�q#|dkrat||�q#|dkr�t||dd�q#|dkr�t||�q#|dkr�t||dd	�q#|d
kr#t||dd�q#q#W|r$|jjd
d�x!|D]}|jj|�qWndS(NR�R�tfFR�sFAIL %stsStEterrorsERROR %stpRts	PASSED %st=sshort test summary info(treportcharstshow_xfailedtshow_xpassedtshow_simpletshow_skippedt_twtsepR�(tterminalreporterttrtlinestcharR�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pytpytest_terminal_summarys*	
cC`sY|jj|�}|rUx:|D]/}|jj|j�}|j||f�qWndS(N(tstatsR7R)tcwd_relative_nodeidtnodeidR%(R�R�tstatR�R�R�tpos((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyR�7s

cC`s�|jjd�}|r~xc|D]X}|jj|j�}|j}|jd|f�|r|jdt|��qqWndS(NR�sXFAIL %ss  (R�R7R)R�R�R�R%Ra(R�R�R�R�R�R/((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyR�?s
	cC`se|jjd�}|raxF|D];}|jj|j�}|j}|jd||f�qWndS(NR�sXPASS %s %s(R�R7R)R�R�R�R%(R�R�R�R�R�R/((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyR�Js
	cC`s�t|d�si|_ny|j|SWnPtk
r|ddl}|jj|dd�}t||�|j|<}|SXdS(Nt
_evalcacheitmodeteval(R;R�tKeyErrort
_pytest._codet_codetcompileR�(R)RJRRt_pytesttexprcodeR�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyR]Ss
cC`szi}x0|D](}|j}|j|g�j|�q
Wg}x4|j�D]&\}}|jt|�f|�qLW|S(N(R�t
setdefaultR%titemstlen(R�RRteventtkeytltevents((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pytfolded_skips_s
	c	C`s�|}|jjdg�}|r�t|�}|r�xV|D]K\}}}}|jd�rh|d}n|jd||||f�q:Wq�ndS(NR�s	Skipped: i	sSKIP [%d] %s:%d: %s(R�R7R�t
startswithR%(	R�R�R�R�tfskipstnumtfspathtlinenoR/((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyR�ks
((%R-t
__future__RRRRNRDRHRZt_pytest.configRt_pytest.markRRt_pytest.runnerRRRR*R'R&RR1R.RnRuRjRqR�R�R�R�R�R�R]R�R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/skipping.pyt<module>s6	
	$	\				2