Your IP : 216.73.216.196


Current Path : /opt/alt/python27/lib/python2.7/site-packages/pytest_relaxed/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/pytest_relaxed/trap.pyo

�
��W[c@sadZddlZddlmZddlZddlmZdefd��YZd�ZdS(s�
Test decorator for capturing stdout/stderr/both.

Based on original code from Fabric 1.x, specifically:

* fabric/tests/utils.py
* as of Git SHA 62abc4e17aab0124bf41f9c5f9c4bc86cc7d9412

Though modifications have been made since.
i����N(twraps(tBytesIOt
CarbonCopycBs>eZdZddd�Zd�Zed��Zd�ZRS(sS
    An IO wrapper capable of multiplexing its writes to other buffer objects.
    tcCsMtj||�|dkr%g}nt|d�r@|g}n||_dS(s�
        If ``cc`` is given and is a file-like object or an iterable of same,
        it/they will be written to whenever this instance is written to.
        twriteN(tIOt__init__tNonethasattrtcc(tselftbufferR	((sD/opt/alt/python27/lib/python2.7/site-packages/pytest_relaxed/trap.pyRs	cCsYt|tj�r$|jd�}ntj||�x|jD]}|j|�q>WdS(Nsutf-8(t
isinstancetsixt	text_typetencodeRRR	(R
tstwriter((sD/opt/alt/python27/lib/python2.7/site-packages/pytest_relaxed/trap.pyR%s
cCs|S(N((R
((sD/opt/alt/python27/lib/python2.7/site-packages/pytest_relaxed/trap.pyR1scCs7tj|�}t|tj�r3|jd�}n|S(Nsutf-8(RtgetvalueRR
tbinary_typetdecode(R
tret((sD/opt/alt/python27/lib/python2.7/site-packages/pytest_relaxed/trap.pyR6sN(	t__name__t
__module__t__doc__RRRtpropertyRR(((sD/opt/alt/python27/lib/python2.7/site-packages/pytest_relaxed/trap.pyRs
	cst���fd��}|S(s
    Replace sys.std(out|err) with a wrapper during execution, restored after.

    In addition, a new combined-streams output (another wrapper) will appear at
    ``sys.stdall``. This stream will resemble what a user sees at a terminal,
    i.e. both out/err streams intermingled.
    cs{t�t_tjtdtj�}t_tjtdtj�}t_z�||�SWd|t_|t_t`XdS(NR	(Rtsyststdalltstdouttstderr(targstkwargst	my_stdoutt	my_stderr(tfunc(sD/opt/alt/python27/lib/python2.7/site-packages/pytest_relaxed/trap.pytwrapperFs		(R(R"R#((R"sD/opt/alt/python27/lib/python2.7/site-packages/pytest_relaxed/trap.pyttrap=s	(	RRt	functoolsRR
RRRR$(((sD/opt/alt/python27/lib/python2.7/site-packages/pytest_relaxed/trap.pyt<module>
s*