403Webshell
Server IP : 127.0.0.1  /  Your IP : 216.73.216.109
Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10
System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64
User : SERVERWEB ( 0)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : OFF |  Perl : OFF |  Python : OFF |  Sudo : OFF |  Pkexec : OFF
Directory :  C:/cygwin64/lib/python3.9/site-packages/_pytest/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.9/site-packages/_pytest/__pycache__/capture.cpython-39.pyc
a

05d���@s
dZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl%m'Z'ddl(m)Z)ddl(m*Z*ddl(m+Z+e�r�ddl,m-Z-dd l,m.Z.e.d!Z/e"dd"�d#d$�Z0dd%�d&d'�Z1edd(�d)d*�Z2e d+d,�ed-�d.d/��Z3Gd0d1�d1ej4�Z5Gd2d3�d3ej4�Z6Gd4d5�d5e6�Z7Gd6d7�d7e�Z8Gd8d9�d9ej9ee�Z:d:d;d<d=�Z;Gd>d?�d?e:e<�Z=Gd@dA�dAe:e�Z>GdBdC�dCe>e?�Z@GdDdE�dEe>e<�ZAGdFdG�dGe:e�ZBGdHdI�dIeBe?�ZCGdJdK�dKeBe<�ZDejEdLk�s�e�reGdMdN�dNeee��ZFn"GdOdN�dNe�GdNdPdQg�ee�ZFGdRdS�dSee�ZHdTeHe<dU�dVdW�ZIGdXdY�dY�ZJGdZd[�d[ee�ZKe&e'eeKe<ddfd\�d]d^��ZLe&e'eeKe?ddfd\�d_d`��ZMe&e'eeKe<ddfd\�dadb��ZNe&e'eeKe?ddfd\�dcdd��ZOdS)ez+Per-test stdout/stderr capturing mechanism.�N��UnsupportedOperation)�
TemporaryFile)�
TracebackType)�Any)�AnyStr)�BinaryIO)�	Generator)�Generic)�Iterable)�Iterator)�List)�
NamedTuple)�Optional)�TextIO)�Tuple)�Type)�
TYPE_CHECKING)�Union)�final)�Config)�hookimpl)�Parser)�check_ispytest)�fixture)�
SubRequest)�	Collector)�File)�Item)�Final)�Literal��fd�sys�no�tee-sys)�parser�returncCs<|�d�}|jddddgd�dd�|jd	d
ddd
d�dS)NZgeneralz	--capture�storer"�methodr!z3Per-test capturing method: one of fd|sys|no|tee-sys)�action�default�metavar�choices�helpz-s�store_constr$�capturezShortcut for --capture=no)r*�const�destr.)ZgetgroupZ
_addoption)r&�group�r4�3/usr/lib/python3.9/site-packages/_pytest/capture.py�pytest_addoption-s 
��r6�r'cCs0tj�d�r,zddl}Wnty*Yn0dS)aEnsure colorama is imported so that it attaches to the correct stdio
    handles on Windows.

    colorama uses the terminal on import time. So if something does the
    first import of colorama while I/O capture is active, colorama will
    fail in various ways.
    �win32rN)r#�platform�
startswith�colorama�ImportError)r;r4r4r5�_colorama_workaround@s
r=)�streamr'cs�tj�d�rttd�rdSt|d�s(dSt|jd���r@|jjn|j}t|tj�sVdS�fdd�}|tj	d�t_	|tj
d	�t_
|tjd	�t_dS)
a�Workaround for Windows Unicode console handling.

    Python 3.6 implemented Unicode console handling for Windows. This works
    by reading/writing to the raw console handle using
    ``{Read,Write}ConsoleW``.

    The problem is that we are going to ``dup2`` over the stdio file
    descriptors when doing ``FDCapture`` and this will ``CloseHandle`` the
    handles used by Python to write to the console. Though there is still some
    weirdness and the console handle seems to only be closed randomly and not
    on the first call to ``CloseHandle``, or maybe it gets reopened with the
    same handle value when we suspend capturing.

    The workaround in this case will reopen stdio with a different fd which
    also means a different handle by replicating the logic in
    "Py_lifecycle.c:initstdio/create_stdio".

    :param stream:
        In practice ``sys.stdout`` or ``sys.stderr``, but given
        here as parameter for unittesting purposes.

    See https://github.com/pytest-dev/py/issues/103.
    r8Zpypy_version_infoN�buffer�rawcsF�s|ddkrd}nd}t�tt�|���||�|j|j|j|j	�S)Nr�w���)
�io�
TextIOWrapper�open�os�dup�fileno�encoding�errors�newlines�line_buffering)�f�mode�	buffering�Zbufferedr4r5�
_reopen_stdiots�z3_windowsconsoleio_workaround.<locals>._reopen_stdio�rb�wb)r#r9r:�hasattrr?r@�
isinstancerCZ_WindowsConsoleIO�stdin�stdout�stderr)r>Z
raw_stdoutrQr4rPr5�_windowsconsoleio_workaroundOs
rYT�Zhookwrapper)�early_configccs�|j}|jdkrttj�t�|j}t|j�}|�|d�|�	|j
�|��dV}|��|j
dur�|��\}}tj�|�tj�|�dS)Nr"�capturemanager)Zknown_args_namespacer0rYr#rWr=�
pluginmanager�CaptureManager�registerZadd_cleanup�stop_global_capturing�start_global_capturing�suspend_global_capture�excinfo�read_global_capture�writerX)r[�nsr]�capman�outcome�out�errr4r4r5�pytest_load_initial_conftests�s



rkc@s4eZdZdZeed�dd��Zeed�dd��ZdS)�EncodedFiler4r7cCs
t|j�S�N)�reprr?��selfr4r4r5�name�szEncodedFile.namecCs|jj�dd�S)N�b�)r?rN�replaceror4r4r5rN�szEncodedFile.modeN)�__name__�
__module__�__qualname__�	__slots__�property�strrqrNr4r4r4r5rl�s
rlcs0eZdZdd��fdd�Zed�dd�Z�ZS)�	CaptureIONr7cst�jt��dddd�dS)N�UTF-8rsT)rI�newline�
write_through)�super�__init__rC�BytesIOro��	__class__r4r5r��szCaptureIO.__init__cCs"t|jtj�sJ�|j���d�S)Nr|)rUr?rCr��getvalue�decoderor4r4r5r��szCaptureIO.getvalue)rurvrwr�rzr��
__classcell__r4r4r�r5r{�sr{cs8eZdZedd��fdd�Zeed��fdd�Z�ZS)�TeeCaptureION)�otherr'cs||_t���dSrm)�_otherrr�)rpr�r�r4r5r��szTeeCaptureIO.__init__)�sr'cst��|�|j�|�Srm)rrer�)rpr�r�r4r5re�szTeeCaptureIO.write)	rurvrwrr�rz�intrer�r4r4r�r5r��sr�c@speZdZeed�dd��Zd3eed�dd�ZeZed�dd	�Z	d4e
eeed
�dd�Ze
ed�d
d�Zed�dd�Zdd�dd�Zed�dd�Zdd�dd�Zed�dd�Zd5eeed�dd�Zed�dd�Zed�d d!�Zd6e
eed�d"d#�Zeed$�d%d&�Zeedd'�d(d)�Zed�d*d+�Zdd�d,d-�Ze
eee
ee
e dd.�d/d0�Z!ee"d�d1d2��Z#dS)7�DontReadFromInputr7cCstjjSrm)r#�	__stdin__rIror4r4r5rI�szDontReadFromInput.encodingrB)�sizer'cCstd��dS�NzJpytest: reading from stdin while output is captured!  Consider using `-s`.��OSError�rpr�r4r4r5�read�s�zDontReadFromInput.readcCs|��Srm)�readlineror4r4r5�__next__�szDontReadFromInput.__next__)�hintr'cCstd��dSr�r�)rpr�r4r4r5�	readlines�s�zDontReadFromInput.readlinescCs|Srmr4ror4r4r5�__iter__�szDontReadFromInput.__iter__cCstd��dS)Nz/redirected stdin is pseudofile, has no fileno()rror4r4r5rH�szDontReadFromInput.filenoNcCstd��dS)Nz.redirected stdin is pseudofile, has no flush()rror4r4r5�flush�szDontReadFromInput.flushcCsdS�NFr4ror4r4r5�isatty�szDontReadFromInput.isattycCsdSrmr4ror4r4r5�close�szDontReadFromInput.closecCsdSr�r4ror4r4r5�readable�szDontReadFromInput.readabler)�offset�whencer'cCstd��dS)Nz0redirected stdin is pseudofile, has no seek(int)r)rpr�r�r4r4r5�seek�szDontReadFromInput.seekcCsdSr�r4ror4r4r5�seekable�szDontReadFromInput.seekablecCstd��dS)Nz-redirected stdin is pseudofile, has no tell()rror4r4r5�tell�szDontReadFromInput.tellcCstd��dS)Nzcannont truncate stdinrr�r4r4r5�truncate�szDontReadFromInput.truncate��datar'cCstd��dS)Nzcannot write to stdinr�rpr�r4r4r5re�szDontReadFromInput.write)�linesr'cCstd��dS)NzCannot write to stdinr)rpr�r4r4r5�
writelines�szDontReadFromInput.writelinescCsdSr�r4ror4r4r5�writable�szDontReadFromInput.writablecCs|Srmr4ror4r4r5�	__enter__�szDontReadFromInput.__enter__)�type�value�	tracebackr'cCsdSrmr4)rpr�r�r�r4r4r5�__exit__szDontReadFromInput.__exit__cCs|Srmr4ror4r4r5r?
szDontReadFromInput.buffer)rB)rB)r)N)$rurvrwryrzrIr�r�r�r�rr
r�rr�rHr��boolr�r�r�r�r�r�r�rerr�r�r�r�
BaseExceptionrr�rr?r4r4r4r5r��s6
�r�c@s�eZdZUeed<ejedd�dd��Zejdd�dd��Z	ejdd�d	d
��Z
ejdd�dd��Zejdd�d
d��Zejedd�dd��Z
ejed�dd��ZdS)�CaptureBase�EMPTY_BUFFERN�r"r'cCs
t��dSrm��NotImplementedError�rpr"r4r4r5r�szCaptureBase.__init__r7cCs
t��dSrmr�ror4r4r5�startszCaptureBase.startcCs
t��dSrmr�ror4r4r5�doneszCaptureBase.donecCs
t��dSrmr�ror4r4r5�suspend"szCaptureBase.suspendcCs
t��dSrmr�ror4r4r5�resume&szCaptureBase.resumer�cCs
t��dSrmr�r�r4r4r5�writeorg*szCaptureBase.writeorgcCs
t��dSrmr�ror4r4r5�snap.szCaptureBase.snap)rurvrwr�__annotations__�abc�abstractmethodr�r�r�r�r�r�r�r�r4r4r4r5r�s
r�rVrWrX)r��c@sveZdZdZedd�dd�Zdd�dd�Zdd�d	d
�Zdd�dd�Zdd�d
d�Z	e
d�dd�Ze
dd�dd�ZdS)�	NoCapturersNr�cCsdSrmr4r�r4r4r5r�9szNoCapture.__init__r7cCsdSrmr4ror4r4r5r�<szNoCapture.startcCsdSrmr4ror4r4r5r�?szNoCapture.donecCsdSrmr4ror4r4r5r�BszNoCapture.suspendcCsdSrmr4ror4r4r5r�EszNoCapture.resumecCsdS�Nrsr4ror4r4r5r�HszNoCapture.snapr�cCsdSrmr4r�r4r4r5r�KszNoCapture.writeorg)
rurvrwr�r�r�r�r�r�r�rzr�r�r4r4r4r5r�6sr�c@s�eZdZddd�eeeedd�dd�Zeed�dd	�Z	ed
�dd�Z
eeed
fdd�dd�Zdd
�dd�Z
dd
�dd�Zdd
�dd�Zdd
�dd�ZdS)�SysCaptureBaseNF��tee)r"�tmpfiler�r'cCsVt|}tt|�|_||_|durF|dkr2t�}n|s<t�nt|j�}||_d|_	dS)NrV�initialized)
�patchsysdict�getattrr#�_oldrqr�r{r�r��_state)rpr"r�r�rqr4r4r5r�PszSysCaptureBase.__init__)�
class_namer'cCs,d�||jt|d�rt|j�p d|j|j�S�Nz(<{} {} _old={} _state={!r} tmpfile={!r}>r�z<UNSET>)�formatrqrTrnr�r�r�)rpr�r4r4r5rn^s�zSysCaptureBase.reprr7cCs0d�|jj|jt|d�r"t|j�p$d|j|j�Sr�)	r�r�rurqrTrnr�r�r�ror4r4r5�__repr__gs�zSysCaptureBase.__repr__.��op�statesr'cCs(|j|vs$Jd�||jd�|����dS�Nz+cannot {} in state {!r}: expected one of {}z, �r�r��join�rpr�r�r4r4r5�
_assert_stateps���zSysCaptureBase._assert_statecCs&|�dd�tt|j|j�d|_dS)Nr��r��started)r��setattrr#rqr�r�ror4r4r5r�wszSysCaptureBase.startcCsB|�dd�|jdkrdStt|j|j�|`|j��d|_dS)Nr��r�r��	suspendedr�)r�r�r�r#rqr�r�r�ror4r4r5r�|s

zSysCaptureBase.donecCs&|�dd�tt|j|j�d|_dS�Nr��r�r�r�)r�r�r#rqr�r�ror4r4r5r��szSysCaptureBase.suspendcCs4|�dd�|jdkrdStt|j|j�d|_dS�Nr�r�r�)r�r�r�r#rqr�ror4r4r5r��s

zSysCaptureBase.resume)N)rurvrwr�rrr�r�rzrnr�rr�r�r�r�r�r4r4r4r5r�Os��
�			r�c@s.eZdZdZed�dd�Zedd�dd�ZdS)	�SysCaptureBinary�r7cCs>|�dd�|j�d�|jj��}|j�d�|j��|S�Nr�r�r�r�r�r�r?r�r��rp�resr4r4r5r��s
zSysCaptureBinary.snapNr�cCs4|�dd�|j��|jj�|�|jj��dS�Nr�r�)r�r�r�r?rer�r4r4r5r��s
zSysCaptureBinary.writeorg)rurvrwr��bytesr�r�r4r4r4r5r��sr�c@s.eZdZdZed�dd�Zedd�dd�ZdS)	�
SysCapturersr7cCs@|�dd�t|jt�sJ�|j��}|j�d�|j��|Sr�)r�rUr�r{r�r�r�r�r4r4r5r��s

zSysCapture.snapNr�cCs&|�dd�|j�|�|j��dSr�)r�r�rer�r�r4r4r5r��szSysCapture.writeorg)rurvrwr�rzr�r�r4r4r4r5r��sr�c@s|eZdZedd�dd�Zed�dd�Zeeedfdd	�d
d�Zdd�dd
�Z	dd�dd�Z
dd�dd�Zdd�dd�ZdS)�
FDCaptureBaseN)�targetfdr'cCs�||_zt�|�Wn2tyFt�tjtj�|_t�|j|�Yn0d|_t�	|�|_
|dkr~ttjdd�|_t|�|_
n<ttdd�ddddd�|_|tvr�t||j�|_
n
t|�|_
d	|_dS)
Nr�utf-8)rI)rOrtrsT)rIrJr}r~r�)r�rF�fstatr�rE�devnull�O_RDWR�targetfd_invalid�dup2rG�
targetfd_saver�r��
syscapturerlrr�r�r�)rpr�r4r4r5r��s,�
zFDCaptureBase.__init__r7cCsd�|jj|j|j|j|j�S)Nz)<{} {} oldfd={} _state={!r} tmpfile={!r}>)r�r�rur�r�r�r�ror4r4r5r��s�zFDCaptureBase.__repr__.r�cCs(|j|vs$Jd�||jd�|����dSr�r�r�r4r4r5r��s���zFDCaptureBase._assert_statecCs4|�dd�t�|j��|j�|j��d|_dS)z4Start capturing on targetfd using memorized tmpfile.r�r�r�N)	r�rFr�r�rHr�r�r�r�ror4r4r5r��s
zFDCaptureBase.startcCs�|�dd�|jdkrdSt�|j|j�t�|j�|jdurd|j|jkrXt�|j�t�|j�|j�	�|j
��d|_dS)z_Stop capturing, restore streams, return original capture file,
        seeked to position zero.r�r�N)r�r�rFr�r�r�r�r�r�r�r�ror4r4r5r��s



zFDCaptureBase.donecCs>|�dd�|jdkrdS|j��t�|j|j�d|_dSr�)r�r�r�r�rFr�r�r�ror4r4r5r�s

zFDCaptureBase.suspendcCsB|�dd�|jdkrdS|j��t�|j��|j�d|_dSr�)	r�r�r�r�rFr�r�rHr�ror4r4r5r�s

zFDCaptureBase.resume)
rurvrwr�r�rzr�rr�r�r�r�r�r4r4r4r5r��s)	r�c@s2eZdZdZdZed�dd�Zedd�dd	�ZdS)
�FDCaptureBinaryzWCapture IO to/from a given OS-level file descriptor.

    snap() produces `bytes`.
    r�r7cCs>|�dd�|j�d�|jj��}|j�d�|j��|Sr�r�r�r4r4r5r�s
zFDCaptureBinary.snapNr�cCs|�dd�t�|j|�dS)�"Write to original file descriptor.r�r�N)r�rFrer�r�r4r4r5r�'szFDCaptureBinary.writeorg)rurvrw�__doc__r�r�r�r�r4r4r4r5r�sr�c@s2eZdZdZdZed�dd�Zedd�dd	�ZdS)
�	FDCapturezTCapture IO to/from a given OS-level file descriptor.

    snap() produces text.
    rsr7cCs<|�dd�|j�d�|j��}|j�d�|j��|Sr�)r�r�r�r�r�r�r4r4r5r�5s

zFDCapture.snapNr�cCs$|�dd�t�|j|�d��dS)r�r�r�r�N)r�rFrer��encoder�r4r4r5r�=szFDCapture.writeorg)rurvrwr�r�rzr�r�r4r4r4r5r�-sr�)��c@s"eZdZUdZeed<eed<dS)�
CaptureResult�2The result of :method:`CaptureFixture.readouterr`.rirjN)rurvrwr�rr�r4r4r4r5r�Js
r�c@seZdZdZdZdS)r�r�r4N)rurvrwr�rxr4r4r4r5r�Ssrirjc@s�eZdZdZdZeeeeeeeeedd�dd�Ze	d�dd�Z
dd�d	d
�Zeeefd�dd�Z
dedd
�dd�Zdd�dd�Zdd�dd�Zed�dd�Zeed�dd�ZdS)�MultiCaptureNF)�in_rirjr'cCs||_||_||_dSrm�r�rirj)rpr�rirjr4r4r5r�_szMultiCapture.__init__r7cCsd�|j|j|j|j|j�S)NzH<MultiCapture out={!r} err={!r} in_={!r} _state={!r} _in_suspended={!r}>)r�rirjr�r��
_in_suspendedror4r4r5r�is�zMultiCapture.__repr__cCs:d|_|jr|j��|jr&|j��|jr6|j��dS)Nr�)r�r�r�rirjror4r4r5�start_capturingrs

zMultiCapture.start_capturingcCsP|��\}}|r*|jdusJ�|j�|�|rH|jdus<J�|j�|�||fS)z?Pop current snapshot out/err capture and flush to orig streams.N)�
readouterrrir�rj�rprirjr4r4r5�pop_outerr_to_orig{szMultiCapture.pop_outerr_to_orig�r�r'cCsDd|_|jr|j��|jr&|j��|r@|jr@|j��d|_dS)Nr�T)r�rir�rjr�r�rpr�r4r4r5�suspend_capturing�s



zMultiCapture.suspend_capturingcCsNd|_|jr|j��|jr&|j��|jrJ|jdus:J�|j��d|_dS)Nr�F)r�rir�rjrr�ror4r4r5�resume_capturing�s


zMultiCapture.resume_capturingcCsL|jdkrtd��d|_|jr(|j��|jr8|j��|jrH|j��dS)z+Stop capturing and reset capturing streams.�stoppedzwas already stoppedN)r��
ValueErrorrir�rjr�ror4r4r5�stop_capturing�s


zMultiCapture.stop_capturingcCs
|jdkS)z7Whether actively capturing -- not suspended or stopped.r�)r�ror4r4r5�
is_started�szMultiCapture.is_startedcCs2|jr|j��nd}|jr$|j��nd}t||�Sr�)rir�rjr�rr4r4r5r�szMultiCapture.readouterr)F)rurvrwr�rrr�rr�rzr�rrrr�rrrrr�rr4r4r4r5r�[s


�
		
r��_CaptureMethod�r)r'cCs�|dkr"ttd�td�td�d�S|dkrDttd�td�td�d�S|dkrZtdddd�S|dkr�tdtdd	d
�tdd	d
�d�Std|����dS)Nr"rr�r�r�r#r$r%Tr�zunknown capturing method: )r�r�r�r
)r)r4r4r5�_get_multicapture�s�rc@s�eZdZdZddd�dd�Zed�dd	�Zeeefd�d
d�Z	ed�dd
�Z
dd�dd�Zdd�dd�Zdd�dd�Z
dCedd�dd�ZdDedd�dd�Zdd�dd�Zeed�dd�Zddd�d d!�Zdd�d"d#�Zdd�d$d%�Zdd�d&d'�Zdd�d(d)�Zdd�d*d+�Zejed,d�d-d.��Zejeeed,d/�d0d1��Zed2d3�e d4�d5d6��Z!ed2d3�eed,d7�d8d9��Z"ed2d3�eed,d7�d:d;��Z#ed2d3�eed,d7�d<d=��Z$ed2d>�dd�d?d@��Z%ed2d>�dd�dAdB��Z&dS)Er^a�The capture plugin.

    Manages that the appropriate capture method is enabled/disabled during
    collection and each test phase (setup, call, teardown). After each of
    those points, the captured output is obtained and attached to the
    collection/runtest report.

    There are two levels of capture:

    * global: enabled by default and can be suppressed by the ``-s``
      option. This is always enabled/disabled during collection and each test
      phase.

    * fixture: when a test function or one of its fixture depend on the
      ``capsys`` or ``capfd`` fixtures. In this case special handling is
      needed to ensure the fixtures take precedence over the global capture.
    r
NrcCs||_d|_d|_dSrm)�_method�_global_capturing�_capture_fixture)rpr)r4r4r5r��szCaptureManager.__init__r7cCsd�|j|j|j�S)NzJ<CaptureManager _method={!r} _global_capturing={!r} _capture_fixture={!r}>)r�rrrror4r4r5r��s�zCaptureManager.__repr__cCs$|��rdS|jr d|jjjSdS)N�globalz
fixture %sF)�is_globally_capturingr�request�fixturenameror4r4r5�is_capturing�s
zCaptureManager.is_capturingcCs
|jdkS)Nr$)rror4r4r5r�sz$CaptureManager.is_globally_capturingcCs(|jdusJ�t|j�|_|j��dSrm)rrrrror4r4r5ra�sz%CaptureManager.start_global_capturingcCs(|jdur$|j��|j��d|_dSrm)rrrror4r4r5r`�s


z$CaptureManager.stop_global_capturingcCs|jdur|j��dSrm)rrror4r4r5�resume_global_capture�s
z$CaptureManager.resume_global_captureFrcCs|jdur|jj|d�dS)N�r�)rrrr4r4r5rb�s
z%CaptureManager.suspend_global_capturecCs|��|�|�dSrm)�suspend_fixturerbrr4r4r5r�szCaptureManager.suspendcCs|��|��dSrm)r�resume_fixtureror4r4r5r�szCaptureManager.resumecCs|jdusJ�|j��Srm)rrror4r4r5rd
sz"CaptureManager.read_global_capturezCaptureFixture[Any])�capture_fixturer'cCs6|jr,|jjj}|jj}|j�d�||��||_dS)Nz%cannot use {} and {} at the same time)rrrZ
raiseerrorr�)rprZcurrent_fixtureZrequested_fixturer4r4r5�set_fixtures
��zCaptureManager.set_fixturecCs
d|_dSrm)rror4r4r5�
unset_fixtureszCaptureManager.unset_fixturecCs|jr|j��dS)z|If the current item is using ``capsys`` or ``capfd``, activate
        them so they take precedence over the global capture.N)r�_startror4r4r5�activate_fixtureszCaptureManager.activate_fixturecCs|jr|j��dS)zDDeactivate the ``capsys`` or ``capfd`` fixture of this item, if any.N)rr�ror4r4r5�deactivate_fixture$sz!CaptureManager.deactivate_fixturecCs|jr|j��dSrm)r�_suspendror4r4r5r)szCaptureManager.suspend_fixturecCs|jr|j��dSrm)r�_resumeror4r4r5r-szCaptureManager.resume_fixture�NNNccsz|jo|j��}|r|��|jo*|j��}|r8|��z"dVW|rN|��|rv|��n|rh|��|rt|��0dS)zLContext manager to temporarily disable global and current fixture capturing.N)r�_is_startedrrrrbrr)rpZ
do_fixtureZ	do_globalr4r4r5�global_and_fixture_disabled3s 
�z*CaptureManager.global_and_fixture_disabled)�when�itemr'c	csr|��|��zdVW|��|jdd�n|��|jdd�0|��\}}|�|d|�|�|d|�dS)NFrrWrX)rr r!rbrdZadd_report_section)rpr'r(rirjr4r4r5�item_captureDs�zCaptureManager.item_captureTrZ)�	collectorccsht|t�r^|��dV}|��|��\}}|��}|rH|j�d|f�|rd|j�d|f�ndVdS)NzCaptured stdoutzCaptured stderr)rUrrrbrdZ
get_resultZsections�append)rpr*rhrirjZrepr4r4r5�pytest_make_collect_reportTs
z)CaptureManager.pytest_make_collect_report)r(r'ccs6|�d|��dVWd�n1s(0YdS)NZsetup�r)�rpr(r4r4r5�pytest_runtest_setupcsz#CaptureManager.pytest_runtest_setupccs6|�d|��dVWd�n1s(0YdS)N�callr-r.r4r4r5�pytest_runtest_callhsz"CaptureManager.pytest_runtest_callccs6|�d|��dVWd�n1s(0YdS)NZteardownr-r.r4r4r5�pytest_runtest_teardownmsz&CaptureManager.pytest_runtest_teardown)ZtryfirstcCs|��dSrm�r`ror4r4r5�pytest_keyboard_interruptrsz(CaptureManager.pytest_keyboard_interruptcCs|��dSrmr3ror4r4r5�pytest_internalerrorvsz#CaptureManager.pytest_internalerror)F)F)'rurvrwr�r�rzr�rr�rrrar`rrbr�r�r�rdrrr r!rr�
contextlib�contextmanagerr	r&rr)rrr,r/r1r2r4r5r4r4r4r5r^�sD	r^c@s�eZdZdZdd�eeeeedd�dd�Z	dd�d	d
�Z
dd�dd�Zeed�d
d�Z
dd�dd�Zdd�dd�Zed�dd�Zejedd�dd��ZdS)�CaptureFixturez|Object returned by the :fixture:`capsys`, :fixture:`capsysbinary`,
    :fixture:`capfd` and :fixture:`capfdbinary` fixtures.F��	_ispytestN)�captureclassrr:r'cCs2t|�||_||_d|_|jj|_|jj|_dSrm)rr;r�_capturer��
_captured_out�
_captured_err)rpr;rr:r4r4r5r�s
zCaptureFixture.__init__r7cCs4|jdur0td|�d�|�d�d�|_|j��dS)Nr�r�r�)r<r�r;rror4r4r5r�s
�zCaptureFixture._startcCsH|jdurD|j��\}}|j|7_|j|7_|j��d|_dSrm)r<rr=r>rrr4r4r5r��s

zCaptureFixture.closecCsT|j|j}}|jdur6|j��\}}||7}||7}|jj|_|jj|_t||�S)z�Read and return the captured output so far, resetting the internal
        buffer.

        :returns:
            The captured content as a namedtuple with ``out`` and ``err``
            string attributes.
        N)r=r>r<rr;r�r�)rpZcaptured_outZcaptured_errrirjr4r4r5r�s


zCaptureFixture.readouterrcCs|jdur|j��dS)z1Suspend this fixture's own capturing temporarily.N)r<rror4r4r5r"�s
zCaptureFixture._suspendcCs|jdur|j��dS)z0Resume this fixture's own capturing temporarily.N)r<rror4r4r5r#�s
zCaptureFixture._resumecCs|jdur|j��SdS)z5Whether actively capturing -- not disabled or closed.NF)r<rror4r4r5r%�s

zCaptureFixture._is_startedr$ccsB|jjj�d�}|���dVWd�n1s40YdS)z>Temporarily disable capturing while inside the ``with`` block.r\N)r�configr]�	getpluginr&)rpZ
capmanagerr4r4r5�disabled�s

�
zCaptureFixture.disabled)rurvrwr�rr�rrr�r�rr�r�rr"r#r%r6r7r	rAr4r4r4r5r8{s �
�	r8)rr'ccsH|jj�d�}tt|dd�}|�|�|��|V|��|��dS)aEnable text capturing of writes to ``sys.stdout`` and ``sys.stderr``.

    The captured output is made available via ``capsys.readouterr()`` method
    calls, which return a ``(out, err)`` namedtuple.
    ``out`` and ``err`` will be ``text`` objects.

    Returns an instance of :class:`CaptureFixture[str] <pytest.CaptureFixture>`.

    Example:

    .. code-block:: python

        def test_output(capsys):
            print("hello")
            captured = capsys.readouterr()
            assert captured.out == "hello\n"
    r\Tr9N)	r?r]r@r8r�rrr�r�rrgrr4r4r5�capsys�s
rCccsH|jj�d�}tt|dd�}|�|�|��|V|��|��dS)a'Enable bytes capturing of writes to ``sys.stdout`` and ``sys.stderr``.

    The captured output is made available via ``capsysbinary.readouterr()``
    method calls, which return a ``(out, err)`` namedtuple.
    ``out`` and ``err`` will be ``bytes`` objects.

    Returns an instance of :class:`CaptureFixture[bytes] <pytest.CaptureFixture>`.

    Example:

    .. code-block:: python

        def test_output(capsysbinary):
            print("hello")
            captured = capsysbinary.readouterr()
            assert captured.out == b"hello\n"
    r\Tr9N)	r?r]r@r8r�rrr�rrBr4r4r5�capsysbinary�s
rDccsH|jj�d�}tt|dd�}|�|�|��|V|��|��dS)aEnable text capturing of writes to file descriptors ``1`` and ``2``.

    The captured output is made available via ``capfd.readouterr()`` method
    calls, which return a ``(out, err)`` namedtuple.
    ``out`` and ``err`` will be ``text`` objects.

    Returns an instance of :class:`CaptureFixture[str] <pytest.CaptureFixture>`.

    Example:

    .. code-block:: python

        def test_system_echo(capfd):
            os.system('echo "hello"')
            captured = capfd.readouterr()
            assert captured.out == "hello\n"
    r\Tr9N)	r?r]r@r8r�rrr�rrBr4r4r5�capfds
rEccsH|jj�d�}tt|dd�}|�|�|��|V|��|��dS)a-Enable bytes capturing of writes to file descriptors ``1`` and ``2``.

    The captured output is made available via ``capfd.readouterr()`` method
    calls, which return a ``(out, err)`` namedtuple.
    ``out`` and ``err`` will be ``byte`` objects.

    Returns an instance of :class:`CaptureFixture[bytes] <pytest.CaptureFixture>`.

    Example:

    .. code-block:: python

        def test_system_echo(capfdbinary):
            os.system('echo "hello"')
            captured = capfdbinary.readouterr()
            assert captured.out == b"hello\n"

    r\Tr9N)	r?r]r@r8r�rrr�rrBr4r4r5�capfdbinary s
rF)Pr�r��collectionsr6rCrFr#rZtempfiler�typesr�typingrrrr	r
rrr
rrrrrrrZ_pytest.compatrZ_pytest.configrrZ_pytest.config.argparsingrZ_pytest.deprecatedrZ_pytest.fixturesrrZ
_pytest.nodesrrrZtyping_extensionsrr r
r6r=rYrkrDrlr{r�r��ABCr�r�rzr�r�r�r�r�r�r�r��version_infor��
namedtupler�rr^r8rCrDrErFr4r4r4r5�<module>s�8	
O Cb
�W9Q   

Youez - 2016 - github.com/yon3zu
LinuXploit