Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/nose/plugins/capture.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�9�c@s�dZddlZddlZddlZddlmZddlmZddlmZej	e
�Zdefd��YZdS(s_
This plugin captures stdout during test execution. If the test fails
or raises an error, the captured output will be appended to the error
or failure output. It is enabled by default but can be disabled with
the options ``-s`` or ``--nocapture``.

:Options:
  ``--nocapture``
    Don't capture stdout (any stdout output will be printed immediately)

i�N(tPlugin(tln(tStringIOtCapturecBs�eZdZeZdZdZdZd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zeeddd�ZRS(s
    Output capture plugin. Enabled by default. Disable with ``-s`` or
    ``--nocapture``. This plugin captures stdout during test execution,
    appending any output captured to the error or failure output,
    should the test fail or raise an error.
    tNOSE_NOCAPTUREtcapturei@cCsg|_d|_dS(N(tstdouttNonet_buf(tself((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pyt__init__"s	cCs9|jddddd|j|j�dddd	�d
S(s%Register commandline options
        s-ss--nocapturetactiontstore_falsetdefaulttdestRthelpsUDon't capture stdout (any stdout output will be printed immediately) [NOSE_NOCAPTURE]N(t
add_optiontgettenv_opt(R	tparsertenv((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pytoptions&scCs"||_|jst|_ndS(s8Configure plugin. Plugin is enabled by default.
        N(tconfRtFalsetenabled(R	RR((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pyt	configure/s		cCs|j�d|_dS(sClear capture buffer.
        N(tendRR(R	ttest((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pyt	afterTest6s
cCs|j�dS(s0Replace sys.stdout with capture buffer.
        N(tstart(R	((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pytbegin<scCs|j�dS(sFlush capture buffer.
        N(R(R	R((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pyt
beforeTestAscCsK|j|_}d|_|s#|S|\}}}||j||�|fS(s-Add captured output to error report.
        N(tbuffertcapturedOutputRRtaddCaptureToErr(R	Rterrtoutputtectevttb((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pytformatErrorFs	cCs|j||�S(s/Add captured output to failure report.
        (R((R	RR#((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pyt
formatFailureSsc	Cst|t�r�t|d�r-t|�}q�t|d�sat|j�rX|jdp[d}n	|j}t|t�r�t|t�r�|jdd�}nd|j	j
|f}nt|t�s�t|�}nt|t�s�jdd�}ndj|t
d	�|t
d
�g�S(Nt__unicode__tmessageittutf8treplaceu%s: %su
u>> begin captured stdout <<u>> end captured stdout <<(t
isinstancet
BaseExceptionthasattrtunicodetlentargsR+t
basestringtdecodet	__class__t__name__treprtjoinR(R	R&R$tmsg((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pyR"Xs %	cCs/|jjtj�t�|_|jt_dS(N(RtappendtsysRR(R	((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pyRoscCs"|jr|jj�t_ndS(N(RtpopR=(R	((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pyRts	cCsx|jr|j�qWdS(sRestore stdout.
        N(RR(R	tresult((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pytfinalizexscCs |jdk	r|jj�SdS(N(RRtgetvalue(R	((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pyt_get_buffer~ssCaptured stdout output.N(R8t
__module__t__doc__tTrueRRtnametscoreR
RRRRRR(R)R"RRR@RBtpropertyRR (((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pyRs(								
						(
RDtloggingtosR=tnose.plugins.baseRt	nose.utilRRt	getLoggerR8tlogR(((s8/sys/lib/python2.7/site-packages/nose/plugins/capture.pyt<module>s

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].