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__/skipping.cpython-37.pyc

B

C$�Xk5�@sdZddlZddlZddlZddlZddlZddlmZmZdd�Z	dd�Z
dd	�ZGd
d�dejj
�Zd.d
d�Zee_
Gdd�d�Zejdd�dd��Zejjdd��Zdd�Zdd�Zejdd�dd��Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Z dS)/z/ support for skip/xfail functions and markers. �N)�MarkInfo�
MarkDecoratorcCs4|�d�}|jdddddd�|jdd	dd
d�dS)NZgeneralz
--runxfail�
store_true�runxfailFz'run tests even if they are marked xfail)�action�dest�default�help�xfail_strictz\default for the strict parameter of xfail markers when not given explicitly (default: False)�bool)r�type)ZgetgroupZ	addoptionZaddini)�parser�group�r�A/opt/alt/python37/lib/python3.7/site-packages/_pytest/skipping.py�pytest_addoptions
rcsd|jjr<tj�|j��fdd��dd�}t|_ttd|�|�	dd�|�	dd�|�	dd	�dS)
Ncsttd��S)N�xfail)�setattr�pytestr)�oldrr�<lambda>�z"pytest_configure.<locals>.<lambda>c_sdS)Nr)�args�kwargsrrr�nopszpytest_configure.<locals>.nopr�markersz�skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test.askipif(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.htmla�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)
�optionrrr�_cleanup�append�XFailed�	ExceptionrZaddinivalue_line)�configrr)rr�pytest_configuresr"cCs
ttd�S)N)r)�dictrrrrr�pytest_namespace:sr$c@seZdZdZdS)rz0 raised from an explicit call to pytest.xfail() N)�__name__�
__module__�__qualname__�__doc__rrrrr>sr�cCsd}t|��dS)zB xfail an executing test or setup functions with the given reason.TN)r)�reasonZ__tracebackhide__rrrrBsrc@sfeZdZdd�Zedd��Zdd�ZeZdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zddd�Z
dd�ZdS)�
MarkEvaluatorcCs||_||_dS)N)�item�name)�selfr,r-rrr�__init__LszMarkEvaluator.__init__cCs|jj�|j�S)N)r,�keywords�getr-)r.rrr�holderPszMarkEvaluator.holdercCs
t|j�S)N)rr2)r.rrr�__bool__TszMarkEvaluator.__bool__cCst|d�S)N�exc)�hasattr)r.rrr�wasvalidXszMarkEvaluator.wasvalidcCs|�d�}|sdSt||�S)N�raises)r1�
isinstance)r.r4r7rrr�invalidraise[s
zMarkEvaluator.invalidraisec
Cs�y|��Stk
r�t��|_t|jdt�rXd|jdjddg}|�d�nt	j
|jdd��}tjd|j
|jd�|�fd	d
�YnXdS)N�� ��^zSyntaxError: invalid syntax�z(Error evaluating %r expression
    %s
%s�
F)�pytrace)�_istruer �sys�exc_infor4r8�SyntaxError�offsetr�	traceback�format_exception_onlyr�failr-�expr�join)r.�msgrrr�istrueas
zMarkEvaluator.istruecCs0tt|jjd�}t|jd�r,|�|jjj�|S)N)�osrBr!�obj)rMrBr,r!r5�updaterN�__globals__)r.�drrr�_getglobalsqszMarkEvaluator._getglobalscCst|d�r|jS|j�r|jjs,d|jjkr�d|_t|jd�rH|jj}n|jj|jjfg}x�|D]�\}}d|krz|df}x||D]t}||_t|tj	j
�r�|��}t|j
j||�}nd|kr�d}t�|�t|�}|r�d|_|�dd�|_||_|jSq�Wq`Wnd|_t|dd�S)N�resultZ	conditionF�_arglistr*zDyou need to specify reason=STRING when using booleans as conditions.T)r5rSr2rrrTrIr8�py�builtinZ_basestringrR�cached_evalr,r!rrHrr1r*�getattr)r.ZarglistrrrIrQrSrKrrrrAws6




zMarkEvaluator._istrueNcCs|jj�||�S)N)r2rr1)r.�attrrrrrr1�szMarkEvaluator.getcCs<t|dd�p|�dd�}|s8t|d�s*dSdt|j�S|S)Nr*rIr)zcondition: )rXr1r5�strrI)r.Zexplrrr�getexplanation�s
zMarkEvaluator.getexplanation)N)r%r&r'r/�propertyr2r3�__nonzero__r6r9rLrRrAr1r[rrrrr+Ks%
r+T)ZtryfirstcCs�|j�d�}t|ttf�r@t|d�}|��r@||_t�	|�
��|j�d�}t|ttf�r�d|_d|jkr|t�	|jd�n"|jr�t�	|jd�n
t�	d�t|d�|_
t|�dS)NZskipif�skipTr*rzunconditional skipr)r0r1r8rrr+rL�	_evalskiprr^r[rr�
_evalxfail�check_xfail_no_run)r,Zskipif_infoZeval_skipifZ	skip_inforrr�pytest_runtest_setup�s 


rbccs(t|�dV}|jdk}|r$t|�dS)N)ra�excinfo�check_strict_xfail)�
pyfuncitem�outcome�passedrrr�pytest_pyfunc_call�s

rhcCs:|jjjs6|j}|��r6|�dd�s6t�d|���dS)zcheck xfail(run=False)�runTz	[NOTRUN] N)	r!rrr`rLr1rrr[)r,�	evalxfailrrrra�s

racCsL|j}|��rH|j�d�}|�d|�}|rH|`|��}tjd|dd�dS)z3check xfail(strict=True) for the given PASSING testr
�strictz[XPASS(strict)] F)r@N)r`rLr!�getinir1r[rrH)rerj�strict_default�is_strict_xfail�explanationrrrrd�srd)�hookwrapperc
cs�dV}|��}t|dd�}t|dd�}t|d�r�|jdkr�ddlm}|jr\d�|j�|_nd|_|�rpd	|_	nd
|_	|j|_
�n.|jjj
r��n |jr�|j�tjj�r�d|jjj|_
d|_	n�|�rd|j�sd|���rd|���rd|j�r|�|jj�r�d	|_	nd|_	|��|_
nR|jdk�r�|j�d
�}|�d|�}|��}	|�rVd	|_	d�|	�|_nd
|_	|	|_
nL|dk	�r�|j�r�t|j�tk�r�|j\}
}}|jdd�\}
}|
||f|_dS)Nr`r_�_unexpectedsuccess�callr)�)_is_unittest_unexpected_success_a_failurezUnexpected success: {0}zUnexpected success�failedrgzreason: �skippedr
rkz[XPASS(strict)] {0}r>)Z
get_resultrXr5ZwhenZ_pytest.compatrsrq�format�longreprrf�wasxfailr!rrrcZ
errisinstancerrr �valuerKrur6rLr9r[rlr1r�tuple�location)
r,rrrf�reprjZevalskiprsrmrnro�filename�liner*rrr�pytest_runtest_makereport�sL

"rcCs0t|d�r,|jrdS|jr,dddddiffSdS)Nrx)�xfailed�xr�xpassed�XZXPASSZyellowT)r5rurg)�reportrrr�pytest_report_teststatuss

r�cCs�|}|jsdSg}x�|jD]�}|dkr2t||�q|dkrFt||�q|dkr^t||dd�q|dkrrt||�q|dkr�t||dd	�q|d
krt||dd�qW|r�|j�d
d�x|D]}|j�|�q�WdS)Nr�r�ZfFrtzFAIL %sZsS�E�errorzERROR %s�prgz	PASSED %s�=zshort test summary info)Zreportchars�show_xfailed�show_xpassed�show_simple�show_skippedZ_tw�sepr~)�terminalreporter�tr�lines�charr~rrr�pytest_terminal_summarys*
r�cCs@|j�|�}|r<x*|D]"}|j�|j�}|�||f�qWdS)N)�statsr1r!�cwd_relative_nodeid�nodeidr)r�r��statrvrtr|�posrrrr�8s

r�cCs\|j�d�}|rXxF|D]>}|j�|j�}|j}|�d|f�|r|�dt|��qWdS)Nr�zXFAIL %sz  )r�r1r!r�r�rxrrZ)r�r�r�r|r�r*rrrr�?s
r�cCsH|j�d�}|rDx2|D]*}|j�|j�}|j}|�d||f�qWdS)Nr�zXPASS %s %s)r�r1r!r�r�rxr)r�r�r�r|r�r*rrrr�Is
r�cCs`t|d�si|_y
|j|Stk
rZddl}|jj|dd�}t||�|j|<}|SXdS)N�
_evalcacher�eval)�mode)r5r��KeyErrorZ
_pytest._code�_code�compiler�)r!rIrQ�_pytestZexprcoder�rrrrWQs

rWcCsti}x<|D]4}|j}t|�dks,t||f��|�|g��|�q
Wg}x(|��D]\}}|�t|�f|�qPW|S)N�)rw�len�AssertionError�
setdefaultr�items)rurQ�event�key�l�eventsrrr�folded_skips]s
r�c	Csh|}|j�dg�}|rdt|�}|rdx@|D]8\}}}}|�d�rJ|dd�}|�d||||f�q(WdS)Nruz	Skipped: �	zSKIP [%d] %s:%d: %s)r�r1r��
startswithr)	r�r�r�ruZfskips�num�fspath�linenor*rrrr�hs
r�)r))!r(rMrBrFrUrZ_pytest.markrrrr"r$rHr rrr+ZhookimplrbZmarkrprhrardrr�r�r�r�r�rWr�r�rrrr�<module>s4
"
^		2