Your IP : 216.73.216.213


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

�
�mYc@`sdZddlmZmZmZddlZddlmZmZm	Z	m
Z
mZddlZddl
Z
ddlZddlZddlZddljZd�Zd�Zd�Zd�Zd	fd
��YZdfd��YZed
�Zd�Zd�Zd�ZdS(st terminal reporting of the full testing process.

This is a good source for looking at the various reporting hooks.
i(tabsolute_importtdivisiontprint_functionN(tEXIT_OKtEXIT_TESTSFAILEDtEXIT_INTERRUPTEDtEXIT_USAGEERRORtEXIT_NOTESTSCOLLECTEDcC`s�|jdddd�}|jddddd	d
ddd
d�f|jddddd	dddd
d�f|jdddd	dddddd
d�|jdddtd	dddd
d�|jdd ddd	d!dtd
d"�|jd#dd$ddd	d%dd&d'd&d(d)d*d+d,gd
d-�|jd.d/dddtd
d0�|jd1dd2ddd	d2dd&d'd3d*d&gd
d4�dS(5Nsterminal reportingt	reportingtaftertgenerals-vs	--verbosetactiontcounttdesttverbosetdefaultithelpsincrease verbosity.s-qs--quiettquietsdecrease verbosity.s-rtstoretreportcharsttmetavartcharss�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. Warnings are displayed at all times except when --disable-warnings is sets--disable-warningss--disable-pytest-warningstdisable_warningst
store_truesdisable warnings summarys-ls--showlocalst
showlocalss0show locals in tracebacks (disabled by default).s--tbtstylettbstyletautotchoicestlongtshorttnotlinetnatives6traceback print mode (auto/long/short/line/native/no).s--fulltraces--full-traces-don't cut any tracebacks (default is to cut).s--colortcolortyess$color terminal output (yes/no/auto).(tgetgroupt
_addoptiontFalse(tparsertgroup((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_addoptions2c`s�|jj|jj8_t|tj��|jj�d�|jjsU|jj	r}�fd�}|j
jjd|�ndS(Ntterminalreporterc`s-djtt|��}�jd|�dS(Nt s[traceconfig] (tjointmaptstrt
write_line(ttagstargstmsg(treporter(sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytmywriter7ss
pytest:config(
toptionRRtTerminalReportertsyststdoutt
pluginmanagertregistertdebugttraceconfigttracetroottsetprocessor(tconfigR5((R4sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_configure2scC`s�d}|jj}|jjr8d|kr8|d7}n-|jjred|kre|jdd�}n|r�xK|D]@}||kr�|dkr�||7}qr|dkrrd}qrqrWn|S(NRtwtatfEsxXw(R6RRtreplace(RAt
reportoptsRtchar((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytgetreportopt<s


cC`sg|jrd}n<|jr$d}n*|jrNd}|jdkrNd}qNn|j||jj�fS(Nt.tstFtcalltf(tpassedtskippedtfailedtwhentoutcometupper(treporttletter((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_report_teststatusKs					t
WarningReportcB`s&eZdZddd�Zd�ZRS(sZ
    Simple structure to hold warnings information captured by ``pytest_logwarning``.
    cC`s(||_||_||_||_dS(sI
        :param code: unused
        :param str message: user friendly message about the warning
        :param str|None nodeid: node id that generated the warning (see ``get_location``).
        :param tuple|py.path.local fslocation:
            file system location of the source of the warning (see ``get_location``).
        N(tcodetmessagetnodeidt
fslocation(tselfRYRZR[R\((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyt__init__[s			cC`s�|jr|jS|jr�t|jt�rt|j�dkr|jd \}}tjj|�j|j	�}d||fSt
|j�SndS(sn
        Returns the more user-friendly information about the location
        of a warning, or None.
        is%s:%sN(R[R\t
isinstancettupletlentpytpathtlocaltreltotinvocation_dirR/tNone(R]RAtfilenametlinenumtrelpath((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytget_locationhs		'N(t__name__t
__module__t__doc__RgR^Rk(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyRXWs
R7cB`s�eZd-d�Zd�Zd�Zdd�Zd�Zd�Zd�Z	d�Z
d-d	�Zd
d�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zed�Zd�Zejde�d��Zd�Zd�Zd�Zejde�d��Z d�Z!d�Z"d �Z#d!�Z$d"�Z%d#�Z&d$�Z'd%�Z(d&�Z)d'�Z*d(�Z+d)�Z,d*�Z-d+�Z.d,�Z/RS(.cC`s�ddl}||_|jjj|_|jdk|_|jdk|_|jdk|_d|_i|_	t
jj�|_
|dkr�tj}n|jj||�|_|_d|_t|�|_|jj|_|j�|_dS(Ni(t_pytest.configRAR6Rt	verbosityt
showheadert
showfspathtshowlongtestinfot
_numcollectedtstatsRbRcRdtstartdirRgR8R9tcreate_terminal_writert_twtwritert
currentfspathRIRt	hasmarkuptisatty(R]RAtfilet_pytest((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR^zs"				cC`s-idd6dd6j||�}||jkS(NtxtxfailedRKRP(tgetR(R]RH((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pythasopt�s cC`s�|jjj|jd�d�}||jkrp||_|jj|�}|jj�|jj	|d�n|jj	|�dS(Ns::iR,(
RAtrootdirR-tsplitRzRvtbestrelpathRxR!twrite(R]R[trestfspath((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytwrite_fspath_result�s"	
RcK`sa|j|kr8|jj�||_|jj|�n|r]|jj||�d|_ndS(Ni����(RzRxR!R�(R]tprefixtextratkwargs((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytwrite_ensure_prefix�s
	cC`s&|jr"|jj�d|_ndS(N(RzRxR!Rg(R]((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytensure_newline�s	
cK`s|jj||�dS(N(RxR�(R]tcontenttmarkup((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR��scK`sNtjj|�s-tjj|dd�}n|j�|jj||�dS(NterrorsRF(Rbtbuiltint_istextttextR�RxR!(R]R!R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR0�s
cK`s't|�}|jjd||�dS(Ns
(R/RxR�(R]R!R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytrewrite�scK`s$|j�|jj|||�dS(N(R�Rxtsep(R]R�ttitleR�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyt	write_sep�s
t=cK`s|jj|||�dS(N(RxR�(R]R�R�tkw((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytsection�scK`s|jj||�dS(N(RxR!(R]R3R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR!�scC`s;x4tjj|�jd�D]}|jd|�qWdS(Ns
sINTERNALERROR> i(RbR�R�R�R0(R]texcreprR!((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_internalerror�s"c	C`sG|jjdg�}td|d|d|d|�}|j|�dS(NtwarningsRYR\RZR[(Rut
setdefaultRXtappend(R]RYR\RZR[R�twarning((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_logwarning�scC`s0|jjjr,d|f}|j|�ndS(NsPLUGIN registered: %s(RAR6R=R0(R]tpluginR3((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_plugin_registered�s
cC`s |jjdg�j|�dS(Nt
deselected(RuR�textend(R]titems((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_deselected�scC`sa|jr.|j||�}|j|d�n/|jr]|jd�d}|j|d�ndS(NRs::i(Rst
_locationlineR�RrR�R�(R]R[tlocationR!tfsid((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_runtest_logstart�s		c	C`s�|}|jjjd|�}|\}}}|jj|g�j|�t|_|rd|rddS|jdkr�t	|d�r�|j
r�|j|j|�q�|j
j|�nt|t�r�|\}}nK|jr�itd6}n2|jritd6}n|jritd6}n|j|j|j�}t	|d�s[|j|||�ni|j�t	|d�r�|j
jd|jjj�n|j
j||�|j
jd|�d	|_dS(
NRUitnodetgreentredtyellows[%s] R,i����(RAthookRWRuR�R�tTruet
_tests_ranRpthasattrRrR�R[RxR�R_R`RORQRPR�R�R�R�R�tgatewaytidRz(	R]RUtrepR�tcatRVtwordR�R!((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_runtest_logreport�s8				
 cC`s9|jr5|jjjdkr5|jddt�ndS(Niscollecting ... tbold(R|RAR6RR�R�(R]((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_collectionscC`s�|jr(|jjdg�j|�n(|jrP|jjdg�j|�ng|jD]}t|tj�rZ|^qZ}|j	t
|�7_	|jr�|j�ndS(NterrorRP(
RQRuR�R�RPtresultR_tpytesttItemRtRaR|treport_collect(R]RURR�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_collectreports		.	cC`s�|jjjdkrdSt|jjdg��}t|jjdg��}|r^d}nd}|t|j�d7}|r�|d|7}n|r�|d|7}n|jr�|r�|d	7}n|j	|d
t
�n
|j|�dS(NiR�RPs
collected scollecting s itemss / %d errorss
 / %d skippeds 
R�(RAR6RRaRuR�R/RtR|R�R�R0(R]tfinalR�RPR!((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR�s"		
cC`s|jt�dS(N(R�R�(R]((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_collection_modifyitems)sttrylastcC`sptj�|_|jsdS|jdddt�tj�}dtj|f}ttd�r�dj	t
ttjd ��}|d|tjdf7}n|d	t
jtjtjf7}|jd
ks�|jjjs�t|jjdd�r
|dttj�7}n|j|�|jjjd
|jd|j�}|j�x!t|�D]}|j|�qUWdS(NR�stest session startsR�splatform %s -- Python %stpypy_version_infoRJis[pypy-%s-%s]s, pytest-%s, py-%s, pluggy-%sitpastebins -- RARv(ttimet_sessionstarttimeRqR�R�tplatformtpython_versionR8R�R-R.R/R�R�t__version__RbtpluggyRpRAR6R<tgetattrRgt
executableR0R�tpytest_report_headerRvtreversetflatten(R]tsessiontverinfoR3tlinesR!((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_sessionstart,s(	

cC`s}d}|jr+d|jj|j�}nd|j|fg}|jj�}|ry|jddjt|���n|S(NRR,srootdir: %s, inifile:%ssplugins: %ss, (tinifileR�R�R:tlist_plugin_distinfoR�R-t_plugin_nameversions(R]RAR�R�t
plugininfo((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR�Cs	cC`s�|jjjry|j|j�|jjd�ru|jjdd�x*|jjd�D]}|j	|j�qWWdSdS|j
s�dSdS(NRQt!scollection failuresii(RAR6tcollectonlyt_printcollecteditemsR�RuR�RxR�t
toterminalRq(R]R�R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_collection_finishPs	cC`s�|jjjdkr�|jjjdkr�i}xA|D]9}|jjdd�d}|j|d�d||<q7Wxyt|j��D]&\}}|jj	d||f�q�Wn<x9|D]1}|j}|j
dd�}|jj	|�q�WdSg}d}x�|D]�}|j�d}	x.|rM||	t|� kr@Pn|j
�q WxS|	t|�D]A}
|j|
�t|�dd}|jj	d	||
f�q_WqWdS(
Nii����s::is%s: %ds::()::Rs  s%s%s(RAR6RR[R�R�tsortedR�RxR!RFt	listchainRatpopR�(R]R�tcountstitemtnameRR[tstacktindenttneeded_collectorstcol((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR�^s2
!
	
	
thookwrappercc`s�dV}|j�|jjd�tttttf}||kr�|jj	j
d|d|�|j�|j�|j
�|j�n|tkr�|j�|`n|j�|j�dS(NRR+t
exitstatus(t
get_resultRxR!RRRRRRAR�tpytest_terminal_summarytsummary_errorstsummary_failurestsummary_warningstsummary_passest_report_keyboardinterruptt_keyboardinterrupt_memotsummary_deselectedt
summary_stats(R]R�RStsummary_exit_codes((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_sessionfinishs"
	




	
cC`s|jdt�|_dS(Ntfuncargs(tgetreprR�R�(R]texcinfo((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_keyboard_interrupt�scC`s t|d�r|j�ndS(NR�(R�R�(R]((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytpytest_unconfigure�scC`s�|j}|jj}|jd|�d|kr|jjjrS|j|j�q|jj	ddt
�|jj|j�ndS(NR�tKeyboardInterrupts=to show a full traceback on KeyboardInterrupt use --fulltraceR�(R�t	reprcrashRZR�RAR6t	fulltraceR�RxR!R�(R]R�R3((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR��s	c`s���fd�}|ru||�jdd�}|jd�d|jdd�kr{|d�jj|�7}q{nd	}|d
S(Nc`s{�jj|�}�rw|j��rw|t�� }�jd�}|djdd�|d<|dj|�7}n|S(Nt[iRJs::(RAtcwd_relative_nodeidtendswithRaR�RFR-(R[R!tl(tdomainR](sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytmkrel�ss::()Rs::is\t/s <- s
[location]R,(RFR�RvR�(R]R[R�tlinenoRRR�((RR]sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR��s
% cC`s-t|d�r%|j\}}}|SdSdS(NR�stest session(R�R�(R]R�R�RR((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyt_getfailureheadline�scC`sVyt|jj�SWn;tk
rQyt|j�d SWqRtk
rMdSXnXdS(Ni2R(R/tlongreprR�tAttributeError(R]R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyt
_getcrashline�s

cC`sIg}x<|jj|g�D]%}t|d�s|j|�qqW|S(Nt	_pdbshown(RuR�R�R�(R]R�RR((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyt
getreports�s
c`s�jd�r�jjd�}|s+dStj|d�fd��}�jdddtdt�x�|D]~\}}�jj	t
|�p�d	�xF|D]>}|jj�}d
j
d�|D��}�jj	|�q�W�jj	�qlW�jj	d�ndS(
NRCR�tkeyc`s|j�j�S(N(RkRA(twr(R](sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyt<lambda>�RR�swarnings summaryR�R�s<undetermined location>s
cs`s|]}d|VqdS(s  N((t.0R((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pys	<genexpr>�ss6-- Docs: http://doc.pytest.org/en/latest/warnings.html(R�RuR�t	itertoolstgroupbyR�R�R'RxR!R/RZt
splitlinesR-(R]tall_warningstgroupedR�R�RCR�tindented((R]sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR��s
cC`s�|jjjdkr�|jd�r�|jd�}|s=dS|jdd�x=|D]2}|j|�}|jd|�|j|�qTWq�ndS(NR tPROR�tPASSESt_(RAR6RR�R
R�Rt_outrep_summary(R]treportsR�R3((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR��s
cC`smxf|jD][\}}d|kr
|jjd|�|ddkrR|d }n|jj|�q
q
WdS(Ntteardownt-i����s
(tsectionsRxR�R!(R]R�tsecnameR�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytprint_teardown_sections�s
cC`s|jjjdkr|jd�}|s.dS|jdd�x�|D]�}|jjjdkr|j|�}|j|�qE|j|�}itd6td6}|jd||�|j	|�xH|jd	�D]7}|j
|j
kr�|jd
kr�|j|�q�q�WqEWndS(NR RQR�tFAILURESR!R�R�RRR(
RAR6RR
R�RR0RR�RR[RRR!(R]RR�R!R3R�RU((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR��s 

!cC`s�|jjjdkr�|jd�}|s.dS|jdd�x�|jdD]�}|j|�}t|d�s}d|}n8|jdkr�d|}n|jd	kr�d
|}n|jd|�|j	|�qLWndS(NR R�R�tERRORSRRsERROR collecting tsetupsERROR at setup of RsERROR at teardown of R(
RAR6RR
R�RuRR�RRR(R]RR�R3((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR�
s


cC`sn|j|j�xW|jD]L\}}|jjd|�|ddkrV|d }n|jj|�qWdS(NRi����s
(R�RxRR�R!(R]R�R R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyRs
cC`s�tj�|j}t|j�\}}d||f}it|6td6}|jdkrq|jd||�n|jdkr�|j||�ndS(Ns%s in %.2f secondsR�iR�i����(R�R�tbuild_summary_stats_lineRuR�RpR�R0(R]tsession_durationR!R#R3R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR�'scC`s=d|jkr9|jddt|jd�dt�ndS(NR�R�s%d tests deselectedR�(RuR�RaR�(R]((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR�2sN(0RlRmRgR^R�R�R�R�R�R0R�R�R�R!R�R�R�R�R�R�R�R�R'R�R�R�thookimplR�R�R�R�R�R�R�R�R�R�RRR
R�R�R!R�R�RR�R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR7ysR														
	$				
		!															cC`sI|dkrtj}nyd|SWnttfk
rDt|�SXdS(Ns%s.%s.%s-%s-%s(RgR8tversion_infot	TypeErrort
ValueErrorR/(tv((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pytrepr_pythonversion7scc`sNxG|D]?}t|ttf�rAx!t|�D]}|Vq/Wq|VqWdS(N(R_tlistR`R�(RRty((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR�?s

cC`s"dj�}t}x?|j�D]1}||kr|rP|j|�t}qPqqWg}xF|D]>}|j|d�}|ra|jdt|�|f�qaqaW|r�dj|�}nd}d|ks�d|kr�d}n6d|ks�|r�d	}nd
|krd}nd	}||fS(Ns?failed passed skipped deselected xfailed xpassed warnings errors%d %ss, sno tests ranRQR�R�R�R�ROR�(	R�R'tkeysR�R�R�RgRaR-(RuR/tunknown_key_seenRtpartstvalR!R#((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR%Gs.

$			cC`skg}x^|D]V\}}djd|�}|jd�rG|d}n||kr
|j|�q
q
W|S(Ns"{dist.project_name}-{dist.version}tdistspytest-i(tformatt
startswithR�(R�RR�R3R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyR�gs
(Rnt
__future__RRRRt_pytest.mainRRRRRR�RbR8R�R�t_pytest._pluggyt_pluggyR�R*RBRIRWRXR7RgR,R�R%R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/terminal.pyt<module>s((		
		"��