Your IP : 216.73.216.196


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

B

C$�X<V�@s�dZddlmZmZmZmZmZddlZddlZddl	Z	ddl
Z
ddlZddlm
Zdd�Zdd�Zdd	�Zd
d�ZGdd
�d
�ZGdd�d�Zddd�Zdd�Zdd�Zdd�ZdS)zt terminal reporting of the full testing process.

This is a good source for looking at the various reporting hooks.
�)�EXIT_OK�EXIT_TESTSFAILED�EXIT_INTERRUPTED�EXIT_USAGEERROR�EXIT_NOTESTSCOLLECTEDNcCs�|jdddd�}|jddddd	d
d�f|jdd
ddd	dd�f|jddddddd�|jdddddd�|jdddddd d�|jd!d"dd#d$d$d%d&d'd(d)gd*d+�|jd,d-ddd.d/�|jd0d1dd1d$d2d'd$gd3d+�dS)4Nzterminal reportingZ	reportingZgeneral)�afterz-vz	--verbose�count�verboserzincrease verbosity.)�action�dest�default�helpz-qz--quiet�quietzdecrease verbosity.z-r�store�reportchars��charsz�show extra test summary info as specified by chars (f)ailed, (E)error, (s)skipped, (x)failed, (X)passed, (p)passed, (P)passed with output, (a)all except pP. The pytest warnings are displayed at all times except when --disable-pytest-warnings is set)r
rr�metavarr
z--disable-pytest-warningsF�disablepytestwarnings�
store_truez-disable warnings summary, overrides -r w flag)rrr
r
z-lz--showlocalsZ
showlocalsz0show locals in tracebacks (disabled by default).z--tbZstyle�tbstyle�auto�long�short�no�lineZnativez6traceback print mode (auto/long/short/line/native/no).)rr
rr�choicesr
z--fulltracez--full-tracez-don't cut any tracebacks (default is to cut).)r
rr
z--color�color�yesz$color terminal output (yes/no/auto).)ZgetgroupZ
_addoption)�parser�group�r!�A/opt/alt/python37/lib/python3.7/site-packages/_pytest/terminal.py�pytest_addoptions2

r#cs^|jj|jj8_t|tj��|j��d�|jjs>|jj	rZ�fdd�}|j
j�d|�dS)N�terminalreportercs"d�tt|��}��d|�dS)N� z[traceconfig] )�join�map�str�
write_line)Ztags�args�msg)�reporterr!r"�mywriter4sz"pytest_configure.<locals>.mywriterz
pytest:config)
�optionr	r�TerminalReporter�sys�stdout�
pluginmanager�register�debug�traceconfig�trace�rootZsetprocessor)�configr-r!)r,r"�pytest_configure/sr9cCs~d}|jj}|jjs&d|kr&|d7}n|jjrBd|krB|�dd�}|rzx2|D]*}||krj|dkrj||7}qL|dkrLd}qLW|S)Nr�w�aZfEsxXw)r.rr�replace)r8Z
reportoptsr�charr!r!r"�getreportopt9s


r>cCsB|jrd}n$|jrd}n|jr0d}|jdkr0d}|j||j��fS)N�.�s�F�call�f)�passed�skipped�failed�when�outcome�upper)�report�letterr!r!r"�pytest_report_teststatusHs
rLc@seZdZddd�ZdS)�
WarningReportNcCs||_||_||_||_dS)N)�code�message�nodeid�
fslocation)�selfrNrOrPrQr!r!r"�__init__TszWarningReport.__init__)NN)�__name__�
__module__�__qualname__rSr!r!r!r"rMSsrMc@sveZdZdZdd�Zdd�Zdd�Zd[d	d
�Zdd�Zd
d�Zdd�Z	dd�Z
d\dd�Zd]dd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd^d+d,�Zd-d.�Zejd/d0�d1d2��Zd3d4�Zd5d6�Zd7d8�Zejd/d9�d:d;��Zd<d=�Zd>d?�Z d@dA�Z!dBdC�Z"dDdE�Z#dFdG�Z$dHdI�Z%dJdK�Z&dLdM�Z'dNdO�Z(dPdQ�Z)dRdS�Z*dTdU�Z+dVdW�Z,dXdY�Z-dS)_r/NcCs�ddl}||_|jjj|_|jdk|_|jdk|_|jdk|_d|_i|_	t
j��|_
|dkrdtj}|j�||�|_|_d|_t|�|_|jj|_|��|_dS)Nr)Z_pytest.configr8r.r	�	verbosity�
showheader�
showfspath�showlongtestinfo�
_numcollected�stats�py�path�local�startdirr0r1Zcreate_terminal_writer�_tw�writer�
currentfspathr>rZ	hasmarkup�isatty)rRr8�file�_pytestr!r!r"rS\s"

zTerminalReporter.__init__cCsddd��||�}||jkS)N�xr@)ZxfailedrE)�getr)rRr=r!r!r"�hasoptpszTerminalReporter.hasoptcCs^|jj�|�d�d�}||jkrN||_|j�|�}|j��|j�	|d�|j�	|�dS)Nz::rr%)
r8�rootdirr&�splitrcr`�bestrelpathrar�write)rRrP�res�fspathr!r!r"�write_fspath_resultts

z$TerminalReporter.write_fspath_resultrcKsD|j|kr&|j��||_|j�|�|r@|jj|f|�d|_dS)N���)rcrarrm)rR�prefix�extra�kwargsr!r!r"�write_ensure_prefix}s

z$TerminalReporter.write_ensure_prefixcCs|jr|j��d|_dS)N)rcrar)rRr!r!r"�ensure_newline�s
zTerminalReporter.ensure_newlinecKs|jj|f|�dS)N)rarm)rR�content�markupr!r!r"rm�szTerminalReporter.writecKs8tj�|�stjj|dd�}|��|jj|f|�dS)Nr<)�errors)r]�builtinZ_istext�textrvrar)rRrrxr!r!r"r)�szTerminalReporter.write_linecKs t|�}|jjd|f|�dS)N�
)r(rarm)rRrrxr!r!r"�rewrite�szTerminalReporter.rewritecKs|��|jj||f|�dS)N)rvra�sep)rRr~�titlerxr!r!r"�	write_sep�szTerminalReporter.write_sep�=cKs|jj||f|�dS)N)rar~)rRrr~�kwr!r!r"�section�szTerminalReporter.sectioncKs|jj|f|�dS)N)rar)rRr+r�r!r!r"r�szTerminalReporter.linecCs.x(tj�|��d�D]}|�d|�qWdS)N�
zINTERNALERROR> �)r]rzr{rkr))rR�excreprrr!r!r"�pytest_internalerror�sz%TerminalReporter.pytest_internalerrorcCs>|j�dg�}t|t�r d|}t||||d�}|�|�dS)N�warningsz%s:%d)rNrQrOrP)r\�
setdefault�
isinstance�tuplerM�append)rRrNrQrOrPr�Zwarningr!r!r"�pytest_logwarning�s

z"TerminalReporter.pytest_logwarningcCs"|jjjrd|f}|�|�dS)NzPLUGIN registered: %s)r8r.r5r))rR�pluginr+r!r!r"�pytest_plugin_registered�s

z)TerminalReporter.pytest_plugin_registeredcCs|j�dg��|�dS)N�
deselected)r\r��extend)rR�itemsr!r!r"�pytest_deselected�sz"TerminalReporter.pytest_deselectedcCsH|jr$|j|f|��}|�|d�n |jrD|�d�d}|�|d�dS)Nrz::r)rZ�
_locationlinerurYrkrp)rRrP�locationrZfsidr!r!r"�pytest_runtest_logstart�sz(TerminalReporter.pytest_runtest_logstartc	CsB|}|jjj|d�}|\}}}|j�|g��|�d|_|sD|sDdS|jdkr|t|d�sn|j	rn|�
|j|�n|j�
|�n�t|t�r�|\}}n.|jr�ddi}n|jr�ddi}n|jr�ddi}|j|jf|j��}t|d�s�|j||f|�nP|��t|d��r|j�
d|jjj�|jj
|f|�|j�
d	|�d
|_dS)N)rJTr�node�green�red�yellowz[%s] r%rq)r8�hookrLr\r�r�Z
_tests_ranrW�hasattrrYrprPrarmr�r�rDrFrEr�r�rurvr�Zgateway�idrc)	rRrJ�reprn�catrK�wordrxrr!r!r"�pytest_runtest_logreport�s8






z)TerminalReporter.pytest_runtest_logreportcCs&|js"|jjjdkr"|jddd�dS)Nr�zcollecting ... T)�bold)rdr8r.r	rm)rRr!r!r"�pytest_collection�sz"TerminalReporter.pytest_collectioncCsj|jr|j�dg��|�n|jr6|j�dg��|�dd�|jD�}|jt|�7_|jrf|�	�dS)N�errorrEcSsg|]}t|tj�r|�qSr!)r��pytestZItem)�.0rgr!r!r"�
<listcomp>�sz9TerminalReporter.pytest_collectreport.<locals>.<listcomp>)
rFr\r�r�rE�resultr[�lenrd�report_collect)rRrJr�r!r!r"�pytest_collectreport�sz%TerminalReporter.pytest_collectreportFcCs�|jjjdkrdSt|j�dg��}t|j�dg��}|r@d}nd}|t|j�d7}|rf|d|7}|rv|d|7}|jr�|r�|d	7}|j	|d
d�n
|�
|�dS)Nrr�rEz
collected zcollecting z itemsz / %d errorsz
 / %d skippedz 
T)r�)r8r.r	r�r\rhr(r[rdr}r))rR�finalryrErr!r!r"r��s"zTerminalReporter.report_collectcCs|�d�dS)NT)r�)rRr!r!r"�pytest_collection_modifyitems
sz.TerminalReporter.pytest_collection_modifyitemsT)ZtrylastcCs
t��|_|jsdS|jdddd�t��}dtj|f}ttd�rtd�t	t
tjdd���}|d	|tjdf7}|d
tj
tj
tj
f7}|jdks�|jjjs�t|jjdd�r�|d
t
tj�7}|�|�|jjj|j|jd�}|��xt|�D]}|�|�q�WdS)Nr�ztest session startsT)r�zplatform %s -- Python %s�pypy_version_infor?�z[pypy-%s-%s]z, pytest-%s, py-%s, pluggy-%srZpastebinz -- )r8r`)�time�_sessionstarttimerXr��platform�python_versionr0r�r&r'r(r�r��__version__r]�pluggyrWr8r.r4�getattr�
executabler)r��pytest_report_headerr`�reverse�flatten)rR�sessionZverinfor+�linesrr!r!r"�pytest_sessionstarts(


z$TerminalReporter.pytest_sessionstartcCsVd}|jrd|j�|j�}d|j|fg}|j��}|rR|�dd�t|���|S)Nrr%zrootdir: %s, inifile:%szplugins: %sz, )�inifilerjrlr2Zlist_plugin_distinfor�r&�_plugin_nameversions)rRr8r�r��
plugininfor!r!r"r�'s
z%TerminalReporter.pytest_report_headercCsh|jjjrZ|�|j�|j�d�rV|j�dd�x |j�d�D]}|�	|j�q>WdSdS|j
sddSdS)NrF�!zcollection failuresr�r)r8r.Zcollectonly�_printcollecteditemsr�r\rhrar~�
toterminalrX)rRr�r�r!r!r"�pytest_collection_finish4s
z)TerminalReporter.pytest_collection_finishcCsP|jjjdkr�|jjjdkr�i}x2|D]*}|j�dd�d}|�|d�d||<q&WxZt|���D]\}}|j�	d||f�qbWn,x*|D]"}|j}|�
dd�}|j�	|�q�WdSg}d}x�|D]�}|��dd�}	x&|r�||	dt|��kr�P|�
�q�WxH|	t|�d�D]4}
|�|
�t|�dd}|j�	d	||
f��qWq�WdS)
Nr���z::r�z%s: %dz::()::rz  z%s%s)r8r.r	rPrkrh�sortedr�rarr<Z	listchainr��popr�)rRr��counts�item�namerrP�stack�indentZneeded_collectors�colr!r!r"r�Bs2



z%TerminalReporter._printcollecteditems)Zhookwrapperccs�dV}|��|j�d�tttttf}||krb|jj	j
||d�|��|��|�
�|��|tkrv|��|`|��|��dS)Nr)r$�
exitstatus)Z
get_resultrarrrrrrr8r�Zpytest_terminal_summary�summary_errors�summary_failures�summary_warnings�summary_passes�_report_keyboardinterrupt�_keyboardinterrupt_memo�summary_deselected�
summary_stats)rRr�rHZsummary_exit_codesr!r!r"�pytest_sessionfinishcs"
z%TerminalReporter.pytest_sessionfinishcCs|jdd�|_dS)NT)Zfuncargs)Zgetreprr�)rR�excinfor!r!r"�pytest_keyboard_interruptxsz*TerminalReporter.pytest_keyboard_interruptcCst|d�r|��dS)Nr�)r�r�)rRr!r!r"�pytest_unconfigure{s
z#TerminalReporter.pytest_unconfigurecCs\|j}|jj}|�d|�d|krX|jjjr:|�|j�n|jj	ddd�|j�|j�dS)Nr��KeyboardInterruptz=to show a full traceback on KeyboardInterrupt use --fulltraceT)r�)
r��	reprcrashrOr�r8r.Z	fulltracer�rar)rRr�r+r!r!r"r�s
z*TerminalReporter._report_keyboardinterruptcs^��fdd�}|rR||��dd�}|�d�d|�dd�krV|d	�j�|�7}nd
}|dS)Ncs\�j�|�}�rX|���rX|dt���}��d�}|d�dd�|d<|d�|�7}|S)N�[rr?z::)r8Zcwd_relative_nodeid�endswithr�rkr<r&)rPr�l)�domainrRr!r"�mkrel�s
z-TerminalReporter._locationline.<locals>.mkrelz::()rz::r�\�/z <- z
[location]r%)r<rkr`rl)rRrPro�linenor�r�rnr!)r�rRr"r��s
zTerminalReporter._locationlinecCs"t|d�r|j\}}}|SdSdS)Nr�ztest session)r�r�)rRr�ror�r�r!r!r"�_getfailureheadline�s
z$TerminalReporter._getfailureheadlinecCsNyt|jj�Stk
rHyt|j�dd�Stk
rBdSXYnXdS)N�2r)r(Zlongreprr��AttributeError)rRr�r!r!r"�
_getcrashline�szTerminalReporter._getcrashlinecCs4g}x*|j�|g�D]}t|d�s|�|�qW|S)NZ	_pdbshown)r\rhr�r�)rRr�r�rgr!r!r"�
getreports�s

zTerminalReporter.getreportscCsX|�d�rT|j�d�}|sdS|�dd�x(|D] }|j�d|j|j|jf�q0WdS)Nr:r�r�zpytest-warning summaryz	W%s %s %s)	rir\rhr�rarrNrQrO)rRr�r:r!r!r"r��s

z!TerminalReporter.summary_warningscCsh|jjjdkrd|�d�rd|�d�}|s*dS|�dd�x,|D]$}|�|�}|�d|�|�|�q<WdS)Nr�PrDr�ZPASSES�_)r8r.rrir�r�r��_outrep_summary)rR�reportsr�r+r!r!r"r��s



zTerminalReporter.summary_passescCsVxP|jD]F\}}d|kr|j�d|�|dd�dkrB|dd�}|j�|�qWdS)N�teardown�-r�r�)�sectionsrar~r)rRr��secnamerwr!r!r"�print_teardown_sections�sz(TerminalReporter.print_teardown_sectionscCs�|jjjdkr�|�d�}|s dS|�dd�x�|D]�}|jjjdkrZ|�|�}|�|�q2|�|�}ddd�}|jd|f|�|�|�x2|�d	�D]$}|j	|j	kr�|j
d
kr�|�|�q�Wq2WdS)NrrFr�ZFAILURESrT)r�r�r�rr�)r8r.rr�r�r�r)r�r�rPrGr�)rRr�r�rr+rxrJr!r!r"r��s 





z!TerminalReporter.summary_failurescCs�|jjjdkr�|�d�}|s dS|�dd�xl|jdD]^}|�|�}t|d�sZd|}n&|jdkrnd|}n|jd	kr�d
|}|�d|�|�	|�q8WdS)Nrr�r�ZERRORSrGzERROR collecting �setupzERROR at setup of r�zERROR at teardown of r�)
r8r.rr�r�r\r�r�rGr�)rRr�r�r+r!r!r"r��s






zTerminalReporter.summary_errorscCsZ|�|j�xH|jD]>\}}|j�d|�|dd�dkrF|dd�}|j�|�qWdS)Nr�r�r�)r�rar�r~r)rRr�r�rwr!r!r"r��sz TerminalReporter._outrep_summarycCsjt��|j}t|j�\}}d||f}|dddi}|jdkrN|jd|f|�|jdkrf|j|f|�dS)Nz%s in %.2f secondsTr�rr�r�)r�r��build_summary_stats_liner\rWr�r))rRZsession_durationrrr+rxr!r!r"r�s

zTerminalReporter.summary_statscCs,d|jkr(|jddt|jd�dd�dS)Nr�r�z%d tests deselectedT)r�)r\r�r�)rRr!r!r"r�s
z#TerminalReporter.summary_deselected)N)r)N)r�)F).rTrUrVrSrirprurvrmr)r}r�r�rr�r�r�r�r�r�r�r�r�r�r�Zhookimplr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r!r!r!r"r/[sR
	
	


$

!
	r/c	Cs8|dkrtj}yd|Sttfk
r2t|�SXdS)Nz%s.%s.%s-%s-%s)r0�version_info�	TypeError�
ValueErrorr()�vr!r!r"�repr_pythonversionsr�ccs@x:|D]2}t|ttf�r2xt|�D]
}|Vq"Wq|VqWdS)N)r��listr�r�)r�rg�yr!r!r"r�s

r�c
Cs�d��}ddi}d}x*|��D]}||kr|r|�|�d}qWg}x>|D]6}|�|d�}|rJ|�||�}|�dt|�|f�qJW|r�d�|�}nd}d	|ks�d
|kr�d}	n$d|ks�|r�d}	nd
|kr�d}	nd}	||	fS)Nz?failed passed skipped deselected xfailed xpassed warnings errorr�zpytest-warningsFTz%d %sz, zno tests ranrFr�r�r�rDr�)rk�keysr�rhr�r&)
r\r�Zkey_translationZunknown_key_seen�key�parts�valZkey_namerrr!r!r"r�#s2

r�cCsNg}xD|D]<\}}dj|d�}|�d�r4|dd�}||kr
|�|�q
W|S)Nz"{dist.project_name}-{dist.version})�distzpytest-�)�format�
startswithr�)r�r�r�rr�r!r!r"r�Es
r�)N)�__doc__Z_pytest.mainrrrrrr�r]r0r�r�Z_pytest._pluggyZ_pluggyr�r#r9r>rLrMr/r�r�r�r�r!r!r!r"�<module>s(
;
"