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

B

C$�X�J�@s�dZddlZddlZddlmZddlZddlZddlmZmZdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
Gdd�d�Zdd�ZdMdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdNd d!�Zd"d#�Zd$d%�ZGd&d'�d'�Zd(d)�ZGd*d+�d+e�Zd,d-�ZGd.d/�d/e�ZGd0d1�d1e�Zd2d3�Z Gd4d5�d5e�Z!Gd6d7�d7e�Z"Gd8d9�d9e�Z#d:d;�Z$Gd<d=�d=e%�Z&Gd>d?�d?e&�Z'Gd@dA�dAe&�Z(GdBdC�dCe)�Z*dDdE�Z+e*e+_%dOdGdH�Z,e'e,_%dPdIdJ�Z-e(e-_%dQdKdL�Z.dS)Rz4 basic collect and runtest protocol implementations �N)�time)�TerminalRepr�
ExceptionInfocCsttttd�S)N)�fail�skip�importorskip�exit)rrrr�r	r	�?/opt/alt/python37/lib/python3.7/site-packages/_pytest/runner.py�pytest_namespacesrcCs,|jdddd�}|jddtdddd	�fdS)
Nzterminal reportingZ	reportingZgeneral)�afterz--durations�store�Nz2show N slowest setup/test durations (N=0 for all).)�action�type�default�metavar�help)ZgetgroupZ	addoption�int)�parser�groupr	r	r
�pytest_addoptionsrcCs�|jjj}|dkrdS|}g}x4|j��D]&}x |D]}t|d�r4|�|�q4Wq*W|s\dS|jdd�d�|��|s�|�	dd�n|�	dd|�|d|�}x2|D]*}|j
�dd	�}|�d
|j
|j|f�q�WdS)N�durationcSs|jS)N)r)�xr	r	r
�<lambda>(�z)pytest_terminal_summary.<locals>.<lambda>)�key�=zslowest test durationszslowest %s test durationsz::()::z::z%02.2fs %-8s %s)�config�option�	durationsZstats�values�hasattr�append�sort�reverseZ	write_sep�nodeid�replaceZ
write_liner�when)Zterminalreporterr �trZdlistZreplist�repr&r	r	r
�pytest_terminal_summarys*



r+cCst�|_dS)N)�
SetupState�_setupstate)�sessionr	r	r
�pytest_sessionstart5sr/cCs|j��dS)N)r-�teardown_all)r.r	r	r
�pytest_sessionfinish7sr1c@seZdZdd�ZdS)�NodeInfocCs
||_dS)N)�location)�selfr3r	r	r
�__init__;szNodeInfo.__init__N)�__name__�
__module__�__qualname__r5r	r	r	r
r2:sr2cCs$|jj|j|jd�t||d�dS)N)r&r3)�nextitemT)�ihookZpytest_runtest_logstartr&r3�runtestprotocol)�itemr9r	r	r
�pytest_runtest_protocol>sr=TcCs�t|d�}|r|js|��t|d|�}|g}|jrb|jjjrFt|�|jjj	sb|�
t|d|��|�
t|d||d��|r�d|_d|_|S)N�_request�setup�call�teardown)r9F)r"r>Z_initrequest�call_and_report�passedrrZ	setupshow�show_test_itemZ	setuponlyr#Zfuncargs)r<�logr9Z
hasrequestr*Zreportsr	r	r
r;Es 




r;cCsV|j��}|��|�d�|�|j�t|jj���}|rR|�d�	d�
|���dS)zAShow test function, parameters and the fixtures of the test item.z        z (fixtures used: {0})z, N)rZget_terminal_writer�line�writeZ_nodeid�sortedZ_fixtureinfoZname2fixturedefs�keys�format�join)r<�twZ
used_fixturesr	r	r
rDYs

rDcCs|jj�|�dS)N)r.r-�prepare)r<r	r	r
�pytest_runtest_setupcsrNcCsPy|��Wn>tk
rJt��\}}}|j}|t_|t_|t_~�YnXdS)N)Zruntest�	Exception�sys�exc_info�tb_next�	last_type�
last_value�last_traceback)r<r�value�tbr	r	r
�pytest_runtest_callfsrXcCs|jj�||�dS)N)r.r-�teardown_exact)r<r9r	r	r
�pytest_runtest_teardownssrZcCs&|jdkr"|jrdS|jrdSdSdS)N)r?rA)�error�E�ERROR)�skipped�sZSKIPPED)�r`r`)r(�failedr^)�reportr	r	r
�pytest_report_teststatusvs
rccKsPt||f|�}|j}|j||d�}|r2|j|d�t||�rL|j|||d�|S)N)r<r@)rb)�noder@rb)�call_runtest_hookr:�pytest_runtest_makereportZpytest_runtest_logreport�check_interactive_exception�pytest_exception_interact)r<r(rE�kwdsr@�hookrbr	r	r
rB�s
rBcCs.|jo,t|d�p*|j�tj�p*|j�tj�S)NZwasxfail)�excinfor"�
errisinstancerrO�bdbZBdbQuit)r@rbr	r	r
rg�s
rgcs,d|}t�j|��t���fdd�|d�S)NZpytest_runtest_cs�fd�i���S)Nr<r	r	)r:r<rir	r
r�rz#call_runtest_hook.<locals>.<lambda>)r()�getattrr:�CallInfo)r<r(riZhooknamer	)r:r<rir
re�srec@s$eZdZdZdZdd�Zdd�ZdS)roz. Result/Exception info a function invocation. NcCsX||_t�|_y|�|_Wn0tk
r8t�|_�Ynt�|_YnXt�|_dS)N)r(r�start�result�KeyboardInterrupt�stoprrk)r4�funcr(r	r	r
r5�szCallInfo.__init__cCs2|jrdt|jj�}nd|jf}d|j|fS)Nz
exception: %sz
result: %rz<CallInfo when=%r %s>)rk�strrVrqr()r4�statusr	r	r
�__repr__�szCallInfo.__repr__)r6r7r8�__doc__rkr5rwr	r	r	r
ro�sroc	Cs\y|jStk
rV|j}d|ddd�}d|d|d||df|_}|SXdS)Nz%s.%s.%s�version_info�z[%s] %s -- Python %s %s�idZsysplatform�
executable)Z_slaveinfocache�AttributeErrorZ	slaveinfo)rd�d�verr_r	r	r
�getslaveinfoline�s r�c@sxeZdZdd�Zdd�Zdd�Zedd��Zed	d
��Zedd��Z	ed
d��Z
edd��Zedd��Zedd��Z
dS)�
BaseReportcKs|j�|�dS)N)�__dict__�update)r4�kwr	r	r
r5�szBaseReport.__init__cCstt|d�r|�t|j��|j}|dkr,dSt|d�rB|�|�n.y|�|�Wntk
rn|�d�YnXdS)Nrd�
toterminalz<unprintable longrepr>)r"rFr�rd�longreprr��UnicodeEncodeError)r4�outr�r	r	r
r��s

zBaseReport.toterminalccs,x&|jD]\}}|�|�r||fVqWdS)N)�sections�
startswith)r4�prefix�name�contentr	r	r
�get_sections�s
zBaseReport.get_sectionscCs0tjjdd�}d|_|�|�|j��}|��S)z�
        Read-only property that returns the full string representation
        of ``longrepr``.

        .. versionadded:: 3.0
        T)�stringioF)�py�ioZTerminalWriterZ	hasmarkupr�r��getvalue�strip)r4rL�excr	r	r
�longreprtext�s


zBaseReport.longreprtextcCsd�dd�|�d�D��S)zaReturn captured text from stdout, if capturing is enabled

        .. versionadded:: 3.0
        r`css|]\}}|VqdS)Nr	)�.0r�r�r	r	r
�	<genexpr>�sz'BaseReport.capstdout.<locals>.<genexpr>zCaptured stdout)rKr�)r4r	r	r
�	capstdout�szBaseReport.capstdoutcCsd�dd�|�d�D��S)zaReturn captured text from stderr, if capturing is enabled

        .. versionadded:: 3.0
        r`css|]\}}|VqdS)Nr	)r�r�r�r	r	r
r��sz'BaseReport.capstderr.<locals>.<genexpr>zCaptured stderr)rKr�)r4r	r	r
�	capstderr�szBaseReport.capstderrcCs
|jdkS)NrC)�outcome)rr	r	r
r�rzBaseReport.<lambda>cCs
|jdkS)Nra)r�)rr	r	r
r�rcCs
|jdkS)Nr^)r�)rr	r	r
r�rcCs|j�d�dS)Nz::r)r&�split)r4r	r	r
�fspath�szBaseReport.fspathN)r6r7r8r5r�r��propertyr�r�r�rCrar^r�r	r	r	r
r��sr�c
	Cs�|j}|j|j}tdd�|jD��}|j}g}|js@d}d}nrt|t�sTd}|}n^|�t	j
j�r�d}|��}	t
|	j�|	j|	jf}n.d}|jdkr�|�|�}n|j||jjjd�}x*|jD] \}
}}|�d||
f|f�q�Wt|j|j||||||�S)	NcSsg|]}|df�qS)�r	)r�rr	r	r
�
<listcomp>�sz-pytest_runtest_makereport.<locals>.<listcomp>rCrar^r@)ZstylezCaptured %s %s)r(rsrp�dict�keywordsrk�
isinstancerrl�pytestrrOZ
_getreprcrashru�path�lineno�message�repr_failure�_repr_failure_pyrrZtbstyleZ_report_sectionsr#�
TestReportr&r3)
r<r@r(rr�rkr�r�r��rZrwhenrr�r	r	r
rf�s2


rfc@s"eZdZdZd	dd�Zdd�ZdS)
r�zY Basic test report object (also used for setup and teardown calls if
    they fail).
    r	rc	
KsD||_||_||_||_||_||_t|�|_||_|j	�
|	�dS)N)r&r3r�r�r�r(�listr�rr�r�)
r4r&r3r�r�r�r(r�r�extrar	r	r
r5s
zTestReport.__init__cCsd|j|j|jfS)Nz"<TestReport %r when=%r outcome=%r>)r&r(r�)r4r	r	r
rw@szTestReport.__repr__N)r	r)r6r7r8rxr5rwr	r	r	r
r�s
!r�c@seZdZdZdZdd�ZdS)�TeardownErrorReportrarAcKs||_g|_|j�|�dS)N)r�r�r�r�)r4r�r�r	r	r
r5GszTeardownErrorReport.__init__N)r6r7r8r�r(r5r	r	r	r
r�Dsr�c	Cs�t|jd�}d}|jsd}nvddlm}tf|��}|j�|�rld}|�|jd�j	}t
|j�|j|j
f}n&d}|�|j�}t|d�s�t|�}|}t|j||t|d	d��}||_|S)
NZmemocollectrCr)�noser^rFrar�rq)roZ_memocollectrk�_pytestr��SkippedZget_skip_exceptionsrlr�Z	reprcrashrur�r�r�r�r"�CollectErrorRepr�
CollectReportr&rnr@)	�	collectorr@r�r�r�Zskip_exceptionsr�Z	errorinfor*r	r	r
�pytest_make_collect_reportLs&

r�c@s*eZdZd	dd�Zedd��Zdd�ZdS)
r�r	cKs6||_||_||_|pg|_t|�|_|j�|�dS)N)r&r�r�rqr�r�r�r�)r4r&r�r�rqr�r�r	r	r
r5es

zCollectReport.__init__cCs|jd|jfS)N)r�)r4r	r	r
r3nszCollectReport.locationcCsd|jt|j�|jfS)Nz*<CollectReport %r lenresult=%s outcome=%r>)r&�lenrqr�)r4r	r	r
rwrszCollectReport.__repr__N)r	)r6r7r8r5r�r3rwr	r	r	r
r�ds
r�c@seZdZdd�Zdd�ZdS)r�cCs
||_dS)N)r�)r4�msgr	r	r
r5wszCollectErrorRepr.__init__cCs|j|jdd�dS)NT)Zred)rFr�)r4r�r	r	r
r�yszCollectErrorRepr.toterminalN)r6r7r8r5r�r	r	r	r
r�vsr�c@sXeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)r,zD shared state for setting up/tearing down test items or collectors. cCsg|_i|_dS)N)�stack�_finalizers)r4r	r	r
r5~szSetupState.__init__cCs:|rt|t�rt�tj�|�s"t�|j�|g��|�dS)z� attach a finalizer to the given colitem.
        if colitem is None, this will add a finalizer that
        is called at the end of teardown_all().
        N)	r��tuple�AssertionErrorr��builtin�callabler��
setdefaultr#)r4�	finalizer�colitemr	r	r
�addfinalizer�szSetupState.addfinalizercCs|j��}|�|�dS)N)r��pop�_teardown_with_finalization)r4r�r	r	r
�_pop_and_teardown�s
zSetupState._pop_and_teardowncCsh|j�|d�}d}x@|rR|��}y
|�Wqtk
rN|dkrJt��}YqXqW|rdtjj|�dS)N)r�r�rOrPrQr�r��_reraise)r4r�Z
finalizersr�Zfinr	r	r
�_callfinalizers�s
zSetupState._callfinalizerscCsP|�|�t|d�r|��x.|jD]$}|dks$||jks$t|t�s$t�q$WdS)NrA)r�r"rAr�r�r�r�r�)r4r�r	r	r
r��s

z&SetupState._teardown_with_finalizationcCs@x|jr|��qWxt|j�D]}|�|�q W|jr<t�dS)N)r�r�r�r�r�r�)r4rr	r	r
r0�s
zSetupState.teardown_allcCs|r|��pg}|�|�dS)N)�	listchain�_teardown_towards)r4r<r9�needed_collectorsr	r	r
rY�szSetupState.teardown_exactcCs2x,|jr,|j|dt|j��kr"P|��qWdS)N)r�r�r�)r4r�r	r	r
r��szSetupState._teardown_towardsc	Cs�|��}|�|�x&|jD]}t|d�rtjj|j�qWxT|t|j�d�D]>}|j�	|�y|�
�WqNtk
r�t�
�|_�YqNXqNWdS)zn setup objects along the collector chain to the test-method
            and teardown previously setup objects.�_prepare_excN)r�r�r�r"r�r�r�r�r�r#r?rOrPrQ)r4r�r��colr	r	r
rM�s


zSetupState.prepareN)
r6r7r8rxr5r�r�r�r�r0rYr�rMr	r	r	r
r,|s
r,cCsN|j}|j|d�|j|d�}|j�dd�}|rJt||�rJ|j|||d�|S)N)r�r@)rdr@rb)r:Zpytest_collectstartr�r�r�rgrh)r�r:r*r@r	r	r
�collect_one_node�sr�c@s&eZdZdZddd�Zdd�ZeZdS)	�OutcomeExceptionzw OutcomeException and its subclass instances indicate and
        contain info about test and collection outcomes.
    NTcCst�||�||_||_dS)N)rOr5r��pytrace)r4r�r�r	r	r
r5�szOutcomeException.__init__cCs8|jr*|j}t|t�r&tjj|dd�}|Sd|jjfS)Nr')�errorsz
<%s instance>)r�r��bytesr�Z_builtinZ_totext�	__class__r6)r4�valr	r	r
rw�s
zOutcomeException.__repr__)NT)r6r7r8rxr5rw�__str__r	r	r	r
r��s
r�c@seZdZdZddd�ZdS)r��builtinsNTFcCstj|||d�||_dS)N)r�r�)r�r5�allow_module_level)r4r�r�r�r	r	r
r5�szSkipped.__init__)NTF)r6r7r8r5r	r	r	r
r��sr�c@seZdZdZdZdS)�Failedz/ raised from an explicit call to pytest.fail() r�N)r6r7r8rxr	r	r	r
r��sr�c@seZdZdZddd�ZdS)�Exitz= raised for immediate program exits (no tracebacks/summaries)�unknown reasoncCs||_t�||�dS)N)r�rrr5)r4r�r	r	r
r5�sz
Exit.__init__N)r�)r6r7r8rxr5r	r	r	r
r��sr�cCsd}t|��dS)z= exit testing process as if KeyboardInterrupt was triggered. TN)r�)r��__tracebackhide__r	r	r
rsrr`cCsd}t|d��dS)a skip an executing test with the given message.  Note: it's usually
    better to use the pytest.mark.skipif marker to declare a test to be
    skipped under certain conditions like mismatching platforms or
    dependencies.  See the pytest_skipping plugin for details.
    T)r�N)r�)r�r�r	r	r
r
srcCsd}t||d��dS)z� explicitly fail an currently-executing test with the given Message.

    :arg pytrace: if false the msg represents the full failure information
                  and no python traceback will be reported.
    T)r�r�N)r�)r�r�r�r	r	r
rsrcCs�d}t|dd�d}yt|�Wntk
r8d}YnX|rPtd|fdd��tj|}|dkrf|St|dd�}|dk	r�yd	d
lm}Wn&tk
r�td|fdd��YnX|dks�||�||�kr�td|||fdd��|S)
z� return imported module if it has at least "minversion" as its
    __version__ attribute.  If no minversion is specified the a skip
    is only triggered if the module can not be imported.
    Tr`�evalFzcould not import %r)r�N�__version__r)�
parse_versionz\we have a required version for %r but can not import pkg_resources to parse version strings.z-module %r has __version__ %r, required is: %r)	�compile�
__import__�ImportErrorr�rP�modulesrn�
pkg_resourcesr�)�modnameZ
minversionr�Zshould_skip�modZverattr�pvr	r	r
r$s0

r)TN)T)r`)r`T)N)/rxrmrPrr�r�Z_pytest._code.coderrrrr+r/r1r2r=r;rDrNrXrZrcrBrgreror��objectr�rfr�r�r�r�r�r,r�rOr�r�r�rrr�rrrrr	r	r	r
�<module>sX





@*N