ó
    ð?ìgŠ  ã            	      ó¨  • S r SSKJr  SSKrSSKrSSKrSSKrSSKJr  SSKrSSK	r	SSK
Jr  SSKJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  \(       a  SSKJr  SSKJr  SSKJ r   SSK!J"r"  SSK#J$r$  SSK%J&r&  SSK%J'r'  SSK(J)r)  SSK(J*r*  SSK(J+r+  SSK,J-r-  \S   r.STS  jr/SUS! jr0SUS" jr1SVS# jr2\ " S$S%9SWS& j5       r3 " S' S(\Rh                  5      r5 " S) S*\Rh                  5      r6 " S+ S,\65      r7 " S- S.\5      r8 " S/ S0\Rr                  \\   5      r:S1S2S3S4.r; " S5 S6\:\<   5      r= " S7 S8\:\   5      r> " S9 S:\>\?   5      r@ " S; S<\>\<   5      rA " S= S>\:\   5      rB " S? S@\B\?   5      rC " SA SB\B\<   5      rD\	RŠ                  SC:¼  d  \(       a  \ " SD SE\\\   5      5       rFO" " SF SE\RŽ                  " SESGSH/5      \\   5      rF " SI SJ\\   5      rHSXSK jrI " SL SM5      rJ " SN SO\\   5      rK\&SYSP j5       rL\&SZSQ j5       rM\&SYSR j5       rN\&SZSS j5       rOg)[z+Per-test stdout/stderr capturing mechanism.é    )ÚannotationsN©ÚUnsupportedOperation)ÚTemporaryFile)ÚTracebackType)ÚAny)ÚAnyStr)ÚBinaryIO)ÚFinal)Úfinal)Ú	Generator)ÚGeneric)ÚIterable)ÚIterator)ÚLiteral)Ú
NamedTuple)ÚTextIO)ÚTYPE_CHECKING)ÚSelf)ÚConfig)Úhookimpl)ÚParser)Úcheck_ispytest)Úfixture)Ú
SubRequest)Ú	Collector)ÚFile)ÚItem)ÚCollectReport©ÚfdÚsysÚnoútee-sysc           	     óx   • U R                  S5      nUR                  SSSS/ SQSS9  UR                  S	S
SSSS9  g )NÚgeneralz	--captureÚstorer!   Úmethodr    z3Per-test capturing method: one of fd|sys|no|tee-sys)ÚactionÚdefaultÚmetavarÚchoicesÚhelpz-sÚstore_constr#   ÚcapturezShortcut for --capture=no)r)   ÚconstÚdestr-   )ÚgetgroupÚ
_addoption)ÚparserÚgroups     Ú1/usr/lib/python3/dist-packages/_pytest/capture.pyÚpytest_addoptionr7   0   sY   € Ø�O‰O˜IÓ&€EØ	×ÑØØØØÚ.ØBð ñ ð 
×ÑØØØØØ(ð ò ó    c                 óx   • [         R                  R                  S5      (       a   SSKn gg! [         a     gf = f)zø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.
Úwin32r   N)r"   ÚplatformÚ
startswithÚcoloramaÚImportError)r=   s    r6   Ú_colorama_workaroundr?   C   s:   € ô ‡|�|×Ñ˜w×'Ñ'ð	Üð (øô ó 	Ùð	ús   ¦, ¬
9¸9c                 ó.   •  SSK n g! [         a     gf = f)aÎ  Ensure readline is imported early so it attaches to the correct stdio handles.

This isn't a problem with the default GNU readline implementation, but in
some configurations, Python uses libedit instead (on macOS, and for prebuilt
binaries such as used by uv).

In theory this is only needed if readline.backend == "libedit", but the
workaround consists of importing readline here, so we already worked around
the issue by the time we could check if we need to.
r   N)Úreadliner>   ©rA   s    r6   Ú_readline_workaroundrC   R   s   € ðÜøÜó Ùðús   ‚ ‡
“c                ó$  ^ • [         R                  R                  S5      (       a  [        [         S5      (       a  g[        T S5      (       d  g[        T R                  S5      (       a  T R                  R
                  OT R                  n[        U[        R                  5      (       d  gU 4S jnU" [         R                  S5      [         l	        U" [         R                  S5      [         l
        U" [         R                  S5      [         l        g)	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.
r:   Úpypy_version_infoNÚbufferÚrawc                ó2  >• [        TR                  S5      (       d  US   S:X  a  SnOSn[        R                  " [	        [
        R                  " U R                  5       5      X5      U R                  U R                  U R                  U R                  5      $ )NrG   r   Úwéÿÿÿÿ)ÚhasattrrF   ÚioÚTextIOWrapperÚopenÚosÚdupÚfilenoÚencodingÚerrorsÚnewlinesÚline_buffering)ÚfÚmodeÚ	bufferingÚstreams      €r6   Ú_reopen_stdioÚ3_windowsconsoleio_workaround.<locals>._reopen_stdio‡   sr   ø€ Ü�v—}‘} e×,Ñ,°°a±¸C³Ø‰IàˆIä×ÒÜ”—’˜Ÿ™›
Ó# TÓ5Ø�J‰JØ�H‰HØ�J‰JØ×Ñó
ð 	
r8   ÚrbÚwb)r"   r;   r<   rK   rF   rG   Ú
isinstancerL   Ú_WindowsConsoleIOÚstdinÚstdoutÚstderr)rY   Ú
raw_stdoutrZ   s   `  r6   Ú_windowsconsoleio_workaroundrd   c   s´   ø€ ô0 �<‰<×"Ñ" 7×+Ñ+¬w´sÐ<O×/PÑ/PØô �6˜8×$Ñ$Øä&-¨f¯m©m¸U×&CÑ&C�—‘×"Ò"ÈÏÉ€Jä�j¤"×"6Ñ"6×7Ñ7Øõ
ñ œcŸi™i¨Ó.„C„IÙœsŸz™z¨4Ó0„C„JÙœsŸz™z¨4Ó0„C…Jr8   T©Úwrapperc              #  ón  #   • U R                   nUR                  S:X  a  [        [        R                  5        [        5         [        5         U R                  n[        UR                  5      nUR                  US5        U R                  UR                  5        UR                  5           S v •  UR                  5         g ! UR                  5         f = f! [         aR    UR                  5       u  pE[        R                  R!                  U5        [        R"                  R!                  U5        e f = f7f)Nr!   Úcapturemanager)Úknown_args_namespacer/   rd   r"   ra   r?   rC   ÚpluginmanagerÚCaptureManagerÚregisterÚadd_cleanupÚstop_global_capturingÚstart_global_capturingÚsuspend_global_captureÚBaseExceptionÚread_global_captureÚwriterb   )Úearly_configÚnsrj   ÚcapmanÚoutÚerrs         r6   Úpytest_load_initial_conftestsry   š   sì   é € à	×	*Ñ	*€BØ	‡z�z�TÓÜ$¤S§Z¡ZÔ0ÜÔÜÔØ ×.Ñ.€MÜ˜BŸJ™JÓ'€FØ×Ñ˜6Ð#3Ô4ð ×Ñ˜V×9Ñ9Ô:ð ×!Ñ!Ô#ð	ð	,Ûà×)Ñ)Õ+øˆF×)Ñ)Õ+ûÜó Ø×-Ñ-Ó/‰ˆÜ�
‰
×Ñ˜ÔÜ�
‰
×Ñ˜ÔØð	üs1   ‚B(D5Â,C Â0C Ã D5ÃCÃC ÃAD2Ä2D5c                  ó@   • \ rS rSrSr\SS j5       r\SS j5       rSrg)ÚEncodedFileé¹   © c                ó,   • [        U R                  5      $ ©N)ÚreprrF   ©Úselfs    r6   ÚnameÚEncodedFile.name¼   s   € ô �D—K‘KÓ Ð r8   c                óN   • U R                   R                  R                  SS5      $ )NÚbÚ )rF   rW   Úreplacer�   s    r6   rW   ÚEncodedFile.modeÂ   s!   € ð �{‰{×Ñ×'Ñ'¨¨RÓ0Ð0r8   N©ÚreturnÚstr)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú	__slots__Úpropertyrƒ   rW   Ú__static_attributes__r}   r8   r6   r{   r{   ¹   s-   † Ø€Iàó!ó ð!ð
 ó1ó ó1r8   r{   c                  ó6   ^ • \ rS rSrSU 4S jjrSS jrSrU =r$ )Ú	CaptureIOéÉ   c                óL   >• [         TU ]  [        R                  " 5       SSSS9  g )NúUTF-8r‡   T)rR   ÚnewlineÚwrite_through)ÚsuperÚ__init__rL   ÚBytesIO)r‚   Ú	__class__s    €r6   rœ   ÚCaptureIO.__init__Ê   s    ø€ Ü‰ÑœŸš›°ÀÐSWÐÒXr8   c                óª   • [        U R                  [        R                  5      (       d   eU R                  R	                  5       R                  S5      $ )Nr˜   )r^   rF   rL   r�   ÚgetvalueÚdecoder�   s    r6   r¡   ÚCaptureIO.getvalueÍ   s;   € Ü˜$Ÿ+™+¤r§z¡z×2Ñ2Ð2Ð2Ø�{‰{×#Ñ#Ó%×,Ñ,¨WÓ5Ð5r8   r}   ©r‹   ÚNonerŠ   )r�   rŽ   r�   r�   rœ   r¡   r“   Ú__classcell__©rž   s   @r6   r•   r•   É   s   ø† ÷Y÷6ò 6r8   r•   c                  ó<   ^ • \ rS rSrSU 4S jjrSU 4S jjrSrU =r$ )ÚTeeCaptureIOéÒ   c                ó.   >• Xl         [        TU ]	  5         g r   )Ú_otherr›   rœ   )r‚   Úotherrž   s     €r6   rœ   ÚTeeCaptureIO.__init__Ó   s   ø€ ØŒÜ‰ÑÕr8   c                óX   >• [         TU ]  U5        U R                  R                  U5      $ r   )r›   rs   r¬   )r‚   Úsrž   s     €r6   rs   ÚTeeCaptureIO.write×   s$   ø€ Ü‰‰�aÔØ�{‰{× Ñ  Ó#Ð#r8   )r¬   )r­   r   r‹   r¥   )r°   rŒ   r‹   Úint)r�   rŽ   r�   r�   rœ   rs   r“   r¦   r§   s   @r6   r©   r©   Ò   s   ø† ÷÷$õ $r8   r©   c                  ó  • \ rS rSr\SS j5       rSSS jjr\rSS jrSSS jjr	SS jr
SS jrSS jrSS	 jrSS
 jrSS jrS S!S jjrSS jrSS jrS"S#S jjrS$S jrS%S jrSS jrS&S jr        S'S jr\S(S j5       rSrg))ÚDontReadFromInputéÜ   c                ó\   • [         R                  c   e[         R                  R                  $ r   )r"   Ú	__stdin__rR   r�   s    r6   rR   ÚDontReadFromInput.encodingÝ   s"   € ä�}‰}Ñ(Ð(Ð(Ü�}‰}×%Ñ%Ð%r8   c                ó   • [        S5      e©NzJpytest: reading from stdin while output is captured!  Consider using `-s`.©ÚOSError©r‚   Úsizes     r6   ÚreadÚDontReadFromInput.readâ   ó   € ÜØXó
ð 	
r8   c                ó"   • U R                  5       $ r   rB   r�   s    r6   Ú__next__ÚDontReadFromInput.__next__é   s   € Ø�}‰}‹Ðr8   c                ó   • [        S5      erº   r»   )r‚   Úhints     r6   Ú	readlinesÚDontReadFromInput.readlinesì   rÁ   r8   c                ó   • U $ r   r}   r�   s    r6   Ú__iter__ÚDontReadFromInput.__iter__ñ   ó   € Øˆr8   c                ó   • [        S5      e)Nz/redirected stdin is pseudofile, has no fileno()r   r�   s    r6   rQ   ÚDontReadFromInput.filenoô   s   € Ü"Ð#TÓUÐUr8   c                ó   • [        S5      e)Nz.redirected stdin is pseudofile, has no flush()r   r�   s    r6   ÚflushÚDontReadFromInput.flush÷   s   € Ü"Ð#SÓTÐTr8   c                ó   • g©NFr}   r�   s    r6   ÚisattyÚDontReadFromInput.isattyú   ó   € Ør8   c                ó   • g r   r}   r�   s    r6   ÚcloseÚDontReadFromInput.closeý   ó   € Ør8   c                ó   • grÓ   r}   r�   s    r6   ÚreadableÚDontReadFromInput.readable   rÖ   r8   c                ó   • [        S5      e)Nz0redirected stdin is pseudofile, has no seek(int)r   )r‚   ÚoffsetÚwhences      r6   ÚseekÚDontReadFromInput.seek  s   € Ü"Ð#UÓVÐVr8   c                ó   • grÓ   r}   r�   s    r6   ÚseekableÚDontReadFromInput.seekable  rÖ   r8   c                ó   • [        S5      e)Nz-redirected stdin is pseudofile, has no tell()r   r�   s    r6   ÚtellÚDontReadFromInput.tell	  s   € Ü"Ð#RÓSÐSr8   Nc                ó   • [        S5      e)Nzcannot truncate stdinr   r½   s     r6   ÚtruncateÚDontReadFromInput.truncate  ó   € Ü"Ð#:Ó;Ð;r8   c                ó   • [        S5      e)Nzcannot write to stdinr   ©r‚   Údatas     r6   rs   ÚDontReadFromInput.write  rì   r8   c                ó   • [        S5      e)NzCannot write to stdinr   )r‚   Úliness     r6   Ú
writelinesÚDontReadFromInput.writelines  rì   r8   c                ó   • grÓ   r}   r�   s    r6   ÚwritableÚDontReadFromInput.writable  rÖ   r8   c                ó   • U $ r   r}   r�   s    r6   Ú	__enter__ÚDontReadFromInput.__enter__  rÌ   r8   c                ó   • g r   r}   )r‚   ÚtypeÚvalueÚ	tracebacks       r6   Ú__exit__ÚDontReadFromInput.__exit__  s   € ð 	r8   c                ó   • U $ r   r}   r�   s    r6   rF   ÚDontReadFromInput.buffer#  s	   € ð ˆr8   r}   rŠ   )rJ   )r¾   r²   r‹   rŒ   )rÆ   ú
int | Noner‹   z	list[str])r‹   zIterator[str])r‹   r²   r¤   ©r‹   Úbool)r   )rß   r²   rà   r²   r‹   r²   r   )r¾   r  r‹   r²   )rï   rŒ   r‹   r²   )rò   zIterable[str]r‹   r¥   )r‹   r   )rü   ztype[BaseException] | Nonerý   zBaseException | Nonerþ   zTracebackType | Noner‹   r¥   )r‹   r
   )r�   rŽ   r�   r�   r’   rR   r¿   rA   rÃ   rÇ   rÊ   rQ   rÐ   rÔ   rØ   rÜ   rá   rä   rç   rê   rs   ró   rö   rù   rÿ   rF   r“   r}   r8   r6   r´   r´   Ü   s³   † Øó&ó ð&ö
ð
 €Hôö
ô
ôVôUôôôöWôôTö<ô<ô<ôôðà(ðð $ðð (ð	ð
 
ôð óó ór8   r´   c                  ó8  • \ rS rSr% S\S'   \R                  SS j5       r\R                  SS j5       r\R                  SS j5       r	\R                  SS j5       r
\R                  SS j5       r\R                  SS	 j5       r\R                  SS
 j5       rSrg)ÚCaptureBasei,  r	   ÚEMPTY_BUFFERc                ó   • [        5       er   ©ÚNotImplementedError©r‚   r!   s     r6   rœ   ÚCaptureBase.__init__/  ó   € ä!Ó#Ð#r8   c                ó   • [        5       er   r
  r�   s    r6   ÚstartÚCaptureBase.start3  r  r8   c                ó   • [        5       er   r
  r�   s    r6   ÚdoneÚCaptureBase.done7  r  r8   c                ó   • [        5       er   r
  r�   s    r6   ÚsuspendÚCaptureBase.suspend;  r  r8   c                ó   • [        5       er   r
  r�   s    r6   ÚresumeÚCaptureBase.resume?  r  r8   c                ó   • [        5       er   r
  rî   s     r6   ÚwriteorgÚCaptureBase.writeorgC  r  r8   c                ó   • [        5       er   r
  r�   s    r6   ÚsnapÚCaptureBase.snapG  r  r8   r}   N©r!   r²   r‹   r¥   r¤   )rï   r	   r‹   r¥   )r‹   r	   )r�   rŽ   r�   r�   Ú__annotations__ÚabcÚabstractmethodrœ   r  r  r  r  r  r  r“   r}   r8   r6   r  r  ,  s¼   ‡ ØÓà×Ñó$ó ð$ð 	×Ñó$ó ð$ð 	×Ñó$ó ð$ð 	×Ñó$ó ð$ð 	×Ñó$ó ð$ð 	×Ñó$ó ð$ð 	×Ñó$ó ó$r8   r  r`   ra   rb   )r   é   é   c                  ó^   • \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	SS jr
SS	 jrS
rg)Ú	NoCaptureiO  r‡   c                ó   • g r   r}   r  s     r6   rœ   ÚNoCapture.__init__R  rÚ   r8   c                ó   • g r   r}   r�   s    r6   r  ÚNoCapture.startU  rÚ   r8   c                ó   • g r   r}   r�   s    r6   r  ÚNoCapture.doneX  rÚ   r8   c                ó   • g r   r}   r�   s    r6   r  ÚNoCapture.suspend[  rÚ   r8   c                ó   • g r   r}   r�   s    r6   r  ÚNoCapture.resume^  rÚ   r8   c                ó   • g©Nr‡   r}   r�   s    r6   r  ÚNoCapture.snapa  s   € Ør8   c                ó   • g r   r}   rî   s     r6   r  ÚNoCapture.writeorgd  rÚ   r8   r}   Nr!  r¤   rŠ   ©rï   rŒ   r‹   r¥   )r�   rŽ   r�   r�   r  rœ   r  r  r  r  r  r  r“   r}   r8   r6   r(  r(  O  s*   † Ø€Lôôôôôô÷r8   r(  c                  ó€   • \ rS rSr SSS.       SS jjjrSS jrSS jrSS jrSS	 jrSS
 jr	SS jr
SS jrSrg)ÚSysCaptureBaseih  NF©Úteec               óÚ   • [         U   n[        [        U5      U l        X@l        Uc7  US:X  a  [        5       nO&U(       d
  [        5       O[        U R                  5      nX l        SU l	        g )Nr`   Úinitialized)
ÚpatchsysdictÚgetattrr"   Ú_oldrƒ   r´   r•   r©   ÚtmpfileÚ_state)r‚   r!   rB  r<  rƒ   s        r6   rœ   ÚSysCaptureBase.__init__i  sU   € ô ˜BÑˆÜ#¤C¨Ó.ˆŒ	ØŒ	Ø‰?Ø�w‹Ü+Ó-‘æ-0œ)œ+´lÀ4Ç9Á9Ó6M�ØŒØ#ˆ�r8   c                óÆ   • SR                  UU R                  [        U S5      =(       a    [        U R                  5      =(       d    SU R
                  U R                  5      $ ©Nz(<{} {} _old={} _state={!r} tmpfile={!r}>rA  z<UNSET>)Úformatrƒ   rK   r€   rA  rC  rB  )r‚   Ú
class_names     r6   r€   ÚSysCaptureBase.reprw  sI   € Ø9×@Ñ@ØØ�I‰IÜ�D˜&Ó!×5¤d¨4¯9©9£o×B¸Ø�K‰KØ�L‰Ló
ð 	
r8   c                óî   • SR                  U R                  R                  U R                  [	        U S5      =(       a    [        U R                  5      =(       d    SU R                  U R                  5      $ rF  )	rG  rž   r�   rƒ   rK   r€   rA  rC  rB  r�   s    r6   Ú__repr__ÚSysCaptureBase.__repr__€  sS   € Ø9×@Ñ@Ø�N‰N×#Ñ#Ø�I‰IÜ�D˜&Ó!×5¤d¨4¯9©9£o×B¸Ø�K‰KØ�L‰Ló
ð 	
r8   c                ó„   • U R                   U;   d0   SR                  XR                   SR                  U5      5      5       eg ©Nz+cannot {} in state {!r}: expected one of {}z, ©rC  rG  Újoin©r‚   ÚopÚstatess      r6   Ú_assert_stateÚSysCaptureBase._assert_state‰  ó;   € à�K‰K˜6Ó!ð	
à8×?Ñ?Ø—‘˜TŸY™Y vÓ.ó
ó	
Ù!r8   c                ó€   • U R                  SS5        [        [        U R                  U R                  5        SU l        g )Nr  ©r>  Ústarted)rT  Úsetattrr"   rƒ   rB  rC  r�   s    r6   r  ÚSysCaptureBase.start�  s.   € Ø×Ñ˜7Ð$4Ô5Ü”�T—Y‘Y §¡Ô-Øˆ�r8   c                óÚ   • U R                  SS5        U R                  S:X  a  g [        [        U R                  U R
                  5        U ?U R                  R                  5         SU l        g )Nr  ©r>  rY  Ú	suspendedr  )rT  rC  rZ  r"   rƒ   rA  rB  rØ   r�   s    r6   r  ÚSysCaptureBase.done•  sR   € Ø×Ñ˜6Ð#RÔSØ�;‰;˜&Ó ØÜ”�T—Y‘Y §	¡	Ô*ØˆIØ�‰×ÑÔØˆ�r8   c                ó€   • U R                  SS5        [        [        U R                  U R                  5        SU l        g ©Nr  ©rY  r^  r^  )rT  rZ  r"   rƒ   rA  rC  r�   s    r6   r  ÚSysCaptureBase.suspendž  s.   € Ø×Ñ˜9Ð&>Ô?Ü”�T—Y‘Y §	¡	Ô*Ø!ˆ�r8   c                ó¢   • U R                  SS5        U R                  S:X  a  g [        [        U R                  U R
                  5        SU l        g ©Nr  rb  rY  )rT  rC  rZ  r"   rƒ   rB  r�   s    r6   r  ÚSysCaptureBase.resume£  s=   € Ø×Ñ˜8Ð%=Ô>Ø�;‰;˜)Ó#ØÜ”�T—Y‘Y §¡Ô-Øˆ�r8   )rA  rC  rƒ   rB  r   )r!   r²   rB  zTextIO | Noner<  r  r‹   r¥   )rH  rŒ   r‹   rŒ   rŠ   ©rR  rŒ   rS  ztuple[str, ...]r‹   r¥   r¤   )r�   rŽ   r�   r�   rœ   r€   rK  rT  r  r  r  r  r“   r}   r8   r6   r:  r:  h  sU   † à04ð$ØEJñ$Øð$Ø -ð$Ø>Bð$à	ö$ô
ô
ô
ô ô
ô"÷
 r8   r:  c                  ó,   • \ rS rSrSrSS jrSS jrSrg)	ÚSysCaptureBinaryi«  r8   c                ó  • U R                  SS5        U R                  R                  S5        U R                  R                  R	                  5       nU R                  R                  S5        U R                  R                  5         U$ ©Nr  rb  r   ©rT  rB  rá   rF   r¿   rê   ©r‚   Úress     r6   r  ÚSysCaptureBinary.snap®  ód   € Ø×Ñ˜6Ð#;Ô<Ø�‰×Ñ˜!ÔØ�l‰l×!Ñ!×&Ñ&Ó(ˆØ�‰×Ñ˜!ÔØ�‰×ÑÔØˆ
r8   c                óî   • U R                  SS5        U R                  R                  5         U R                  R                  R	                  U5        U R                  R                  R                  5         g ©Nr  rb  )rT  rA  rÐ   rF   rs   rî   s     r6   r  ÚSysCaptureBinary.writeorg¶  sO   € Ø×Ñ˜:Ð'?Ô@Ø�	‰	�‰ÔØ�	‰	×Ñ×Ñ˜tÔ$Ø�	‰	×Ñ×ÑÕ r8   r}   N©r‹   Úbytes©rï   ru  r‹   r¥   ©r�   rŽ   r�   r�   r  r  r  r“   r}   r8   r6   ri  ri  «  s   † Ø€Lô÷!r8   ri  c                  ó,   • \ rS rSrSrSS jrSS jrSrg)	Ú
SysCapturei½  r‡   c                ó
  • U R                  SS5        [        U R                  [        5      (       d   eU R                  R	                  5       nU R                  R                  S5        U R                  R                  5         U$ rk  )rT  r^   rB  r•   r¡   rá   rê   rm  s     r6   r  ÚSysCapture.snapÀ  sc   € Ø×Ñ˜6Ð#;Ô<Ü˜$Ÿ,™,¬	×2Ñ2Ð2Ð2Ø�l‰l×#Ñ#Ó%ˆØ�‰×Ñ˜!ÔØ�‰×ÑÔØˆ
r8   c                ó’   • U R                  SS5        U R                  R                  U5        U R                  R                  5         g rr  )rT  rA  rs   rÐ   rî   s     r6   r  ÚSysCapture.writeorgÈ  s1   € Ø×Ñ˜:Ð'?Ô@Ø�	‰	�‰˜ÔØ�	‰	�‰Õr8   r}   NrŠ   r8  rw  r}   r8   r6   ry  ry  ½  s   † Ø€Lô÷r8   ry  c                  óZ   • \ rS rSrSS jrSS jrSS jrSS jrSS jrSS jr	SS jr
S	rg
)ÚFDCaptureBaseiÎ  c                óh  • Xl          [        R                  " U5        S U l        [        R                  " U5      U l
        US:X  a.  [        [        R                  SS9U l        [        U5      U l        ON[        [        SS9SSSSS9U l        U[         ;   a  [        XR                  5      U l        O[#        U5      U l        S	U l        g ! [         a]    [        R
                  " [        R                  [        R                  5      U l        [        R                  " U R                  U5         GNf = f)
Nr   úutf-8)rR   )rX   rˆ   r‡   T)rR   rS   r™   rš   r>  )ÚtargetfdrO   ÚfstatÚtargetfd_invalidr¼   rN   ÚdevnullÚO_RDWRÚdup2rP   Útargetfd_saverB  ry  Ú
syscapturer{   r   r?  r(  rC  )r‚   r‚  s     r6   rœ   ÚFDCaptureBase.__init__Ï  sè   € Ø Œð	)Ü�HŠH�XÔð  %)ˆDÔ!ÜŸVšV HÓ-ˆÔà�q‹=Ü¤§
¡
°WÑ=ˆDŒLÜ0:¸8Ó0DˆD�Oä&Ü¨Ñ*Ø Ø ØØ"ñˆDŒLð œ<Ó'Ü",¨X·|±|Ó"D�•ä"+¨HÓ"5�”à#ˆ�øôE ó 	5ô 13·²¼¿
¹
ÄBÇIÁIÓ0NˆDÔ!Ü�GŠG�D×)Ñ)¨8×4ð	5ús   ˆC
 Ã
A#D1Ä0D1c                ó¢   • SU R                   R                   SU R                   SU R                   SU R                  < SU R
                  < S3$ )NÚ<Ú z oldfd=ú _state=z	 tmpfile=Ú>)rž   r�   r‚  rˆ  rC  rB  r�   s    r6   rK  ÚFDCaptureBase.__repr__ø  sR   € à�—‘×'Ñ'Ð(¨¨$¯-©-¨¸À×@RÑ@RÐ?Sð TØ—k‘k‘_ I¨d¯l©lÑ-=¸Qð@ð	
r8   c                ó„   • U R                   U;   d0   SR                  XR                   SR                  U5      5      5       eg rN  rO  rQ  s      r6   rT  ÚFDCaptureBase._assert_stateþ  rV  r8   c                óÜ   • U R                  SS5        [        R                  " U R                  R	                  5       U R
                  5        U R                  R                  5         SU l        g)z4Start capturing on targetfd using memorized tmpfile.r  rX  rY  N)	rT  rO   r‡  rB  rQ   r‚  r‰  r  rC  r�   s    r6   r  ÚFDCaptureBase.start  sI   € à×Ñ˜7Ð$4Ô5Ü
�Š�—‘×#Ñ#Ó% t§}¡}Ô5Ø�‰×ÑÔØˆ�r8   c                ó$  • U R                  SS5        U R                  S:X  a  g[        R                  " U R                  U R
                  5        [        R                  " U R                  5        U R                  bZ  U R                  U R
                  :w  a   [        R                  " U R
                  5        [        R                  " U R                  5        U R                  R                  5         U R                  R                  5         SU l        g)zWStop capturing, restore streams, return original capture file,
seeked to position zero.r  r]  N)rT  rC  rO   r‡  rˆ  r‚  rØ   r„  r‰  r  rB  r�   s    r6   r  ÚFDCaptureBase.done  sµ   € ð 	×Ñ˜6Ð#RÔSØ�;‰;˜&Ó ØÜ
�Š�×"Ñ" D§M¡MÔ2Ü
�Š�×#Ñ#Ô$Ø× Ñ Ñ,Ø×$Ñ$¨¯©Ó5Ü—’˜Ÿ™Ô'Ü�HŠH�T×*Ñ*Ô+Ø�‰×ÑÔØ�‰×ÑÔØˆ�r8   c                óâ   • U R                  SS5        U R                  S:X  a  g U R                  R                  5         [        R
                  " U R                  U R                  5        SU l        g ra  )rT  rC  r‰  r  rO   r‡  rˆ  r‚  r�   s    r6   r  ÚFDCaptureBase.suspend  sQ   € Ø×Ñ˜9Ð&>Ô?Ø�;‰;˜+Ó%ØØ�‰×ÑÔ!Ü
�Š�×"Ñ" D§M¡MÔ2Ø!ˆ�r8   c                óþ   • U R                  SS5        U R                  S:X  a  g U R                  R                  5         [        R
                  " U R                  R                  5       U R                  5        SU l        g re  )	rT  rC  r‰  r  rO   r‡  rB  rQ   r‚  r�   s    r6   r  ÚFDCaptureBase.resume$  sX   € Ø×Ñ˜8Ð%=Ô>Ø�;‰;˜)Ó#ØØ�‰×ÑÔ Ü
�Š�—‘×#Ñ#Ó% t§}¡}Ô5Øˆ�r8   )rC  r‰  r‚  r„  rˆ  rB  N)r‚  r²   r‹   r¥   rŠ   rg  r¤   )r�   rŽ   r�   r�   rœ   rK  rT  r  r  r  r  r“   r}   r8   r6   r  r  Î  s&   † ô'$ôR
ô
ô ôô "÷ r8   r  c                  ó0   • \ rS rSrSrSrSS jrS	S jrSrg)
ÚFDCaptureBinaryi-  zOCapture IO to/from a given OS-level file descriptor.

snap() produces `bytes`.
r8   c                ó  • U R                  SS5        U R                  R                  S5        U R                  R                  R	                  5       nU R                  R                  S5        U R                  R                  5         U$ rk  rl  rm  s     r6   r  ÚFDCaptureBinary.snap5  rp  r8   c                ój   • U R                  SS5        [        R                  " U R                  U5        g)ú"Write to original file descriptor.r  rb  N)rT  rO   rs   rˆ  rî   s     r6   r  ÚFDCaptureBinary.writeorg=  s'   € à×Ñ˜:Ð'?Ô@Ü
�Š�×#Ñ# TÕ*r8   r}   Nrt  rv  ©	r�   rŽ   r�   r�   Ú__doc__r  r  r  r“   r}   r8   r6   rœ  rœ  -  s   † ñð
 €Lô÷+r8   rœ  c                  ó0   • \ rS rSrSrSrSS jrS	S jrSrg)
Ú	FDCaptureiC  zLCapture IO to/from a given OS-level file descriptor.

snap() produces text.
r‡   c                óþ   • U R                  SS5        U R                  R                  S5        U R                  R                  5       nU R                  R                  S5        U R                  R	                  5         U$ rk  )rT  rB  rá   r¿   rê   rm  s     r6   r  ÚFDCapture.snapK  s^   € Ø×Ñ˜6Ð#;Ô<Ø�‰×Ñ˜!ÔØ�l‰l×ÑÓ!ˆØ�‰×Ñ˜!ÔØ�‰×ÑÔØˆ
r8   c                óˆ   • U R                  SS5        [        R                  " U R                  UR	                  S5      5        g)r   r  rb  r�  N)rT  rO   rs   rˆ  Úencoderî   s     r6   r  ÚFDCapture.writeorgS  s0   € à×Ñ˜:Ð'?Ô@ä
�Š�×#Ñ# T§[¡[°Ó%9Õ:r8   r}   NrŠ   r8  r¢  r}   r8   r6   r¥  r¥  C  s   † ñð
 €Lô÷;r8   r¥  )é   é   c                  ó.   • \ rS rSr% SrS\S'   S\S'   Srg)ÚCaptureResulti`  úOThe result of :method:`caplog.readouterr() <pytest.CaptureFixture.readouterr>`.r	   rw   rx   r}   N)r�   rŽ   r�   r�   r£  r"  r“   r}   r8   r6   r®  r®  `  s   ‡ á]à‹ØŽr8   r®  c                  ó   • \ rS rSrSrSrSrg)r®  ii  r¯  r}   N)r�   rŽ   r�   r�   r£  r‘   r“   r}   r8   r6   r®  r®  i  s   † ñ 	^à‹	r8   rw   rx   c                  óŠ   • \ rS rSrSrSr        SS jrSS jrSS jrSS jr	SSS jjr
SS	 jrSS
 jrSS jrSS jrSrg)ÚMultiCaptureir  NFc                ó(   • Xl         X l        X0l        g r   ©Úin_rw   rx   )r‚   rµ  rw   rx   s       r6   rœ   ÚMultiCapture.__init__v  s   € ð 03ŒØ/2ŒØ/2�r8   c                ó”   • SU R                   < SU R                  < SU R                  < SU R                  < SU R                  < S3$ )Nz<MultiCapture out=z err=z in_=rŽ  z _in_suspended=r�  )rw   rx   rµ  rC  Ú_in_suspendedr�   s    r6   rK  ÚMultiCapture.__repr__€  sJ   € à  §¡¡¨E°$·(±(±¸UÀ4Ç8Á8Á,ð OØ—k‘k‘_ O°D×4FÑ4FÑ3IÈðLð	
r8   c                ó  • SU l         U R                  (       a  U R                  R                  5         U R                  (       a  U R                  R                  5         U R                  (       a  U R                  R                  5         g g )NrY  )rC  rµ  r  rw   rx   r�   s    r6   Ústart_capturingÚMultiCapture.start_capturing†  sM   € ØˆŒØ�8�8Ø�H‰H�N‰NÔØ�8�8Ø�H‰H�N‰NÔØ�8�8Ø�H‰H�N‰NÕð r8   c                óð   • U R                  5       u  pU(       a*  U R                  c   eU R                  R                  U5        U(       a*  U R                  c   eU R                  R                  U5        X4$ )z?Pop current snapshot out/err capture and flush to orig streams.)Ú
readouterrrw   r  rx   ©r‚   rw   rx   s      r6   Úpop_outerr_to_origÚMultiCapture.pop_outerr_to_orig�  sa   € à—?‘?Ó$‰ˆÞØ—8‘8Ñ'Ð'Ð'Ø�H‰H×Ñ˜cÔ"ÞØ—8‘8Ñ'Ð'Ð'Ø�H‰H×Ñ˜cÔ"Øˆxˆr8   c                ó4  • SU l         U R                  (       a  U R                  R                  5         U R                  (       a  U R                  R                  5         U(       a4  U R                  (       a"  U R                  R                  5         SU l        g g g )Nr^  T)rC  rw   r  rx   rµ  r¸  ©r‚   rµ  s     r6   Úsuspend_capturingÚMultiCapture.suspend_capturingš  s_   € Ø!ˆŒØ�8�8Ø�H‰H×ÑÔØ�8�8Ø�H‰H×ÑÔÞ�4—8—8Ø�H‰H×ÑÔØ!%ˆDÕð ˆ3r8   c                óB  • SU l         U R                  (       a  U R                  R                  5         U R                  (       a  U R                  R                  5         U R                  (       a1  U R
                  c   eU R
                  R                  5         SU l        g g )NrY  F)rC  rw   r  rx   r¸  rµ  r�   s    r6   Úresume_capturingÚMultiCapture.resume_capturing¤  sg   € ØˆŒØ�8�8Ø�H‰H�O‰OÔØ�8�8Ø�H‰H�O‰OÔØ××Ø—8‘8Ñ'Ð'Ð'Ø�H‰H�O‰OÔØ!&ˆDÕð r8   c                óL  • U R                   S:X  a  [        S5      eSU l         U R                  (       a  U R                  R                  5         U R                  (       a  U R                  R                  5         U R
                  (       a  U R
                  R                  5         gg)z+Stop capturing and reset capturing streams.Ústoppedzwas already stoppedN)rC  Ú
ValueErrorrw   r  rx   rµ  r�   s    r6   Ústop_capturingÚMultiCapture.stop_capturing¯  sb   € à�;‰;˜)Ó#ÜÐ2Ó3Ð3ØˆŒØ�8�8Ø�H‰H�M‰MŒOØ�8�8Ø�H‰H�M‰MŒOØ�8�8Ø�H‰H�M‰M�Oð r8   c                ó    • U R                   S:H  $ )z7Whether actively capturing -- not suspended or stopped.rY  )rC  r�   s    r6   Ú
is_startedÚMultiCapture.is_started»  s   € à�{‰{˜iÑ'Ð'r8   c                óÌ   • U R                   (       a  U R                   R                  5       OSnU R                  (       a  U R                  R                  5       OSn[        X5      $ r4  )rw   r  rx   r®  r¿  s      r6   r¾  ÚMultiCapture.readouterr¿  s;   € Ø!%§§ˆd�h‰h�m‰mŒo¨rˆØ!%§§ˆd�h‰h�m‰mŒo¨rˆä˜SÓ&Ð&r8   )r¸  rC  rx   rµ  rw   )rµ  úCaptureBase[AnyStr] | Nonerw   rÓ  rx   rÓ  r‹   r¥   rŠ   r¤   )r‹   ztuple[AnyStr, AnyStr]©F©rµ  r  r‹   r¥   r  ©r‹   zCaptureResult[AnyStr])r�   rŽ   r�   r�   rC  r¸  rœ   rK  r»  rÀ  rÄ  rÇ  rÌ  rÏ  r¾  r“   r}   r8   r6   r²  r²  r  s_   † Ø€FØ€Mð3à'ð3ð (ð3ð (ð	3ð
 
ô3ô
ôô	ö&ô	'ô
ô(÷'r8   r²  c           	     ó4  • U S:X  a&  [        [        S5      [        S5      [        S5      S9$ U S:X  a&  [        [        S5      [        S5      [        S5      S9$ U S:X  a  [        S S S S9$ U S:X  a  [        S [        SS	S
9[        SS	S
9S9$ [        SU < 35      e)Nr!   r   r%  r&  r´  r"   r#   r$   Tr;  zunknown capturing method: )r²  r¥  ry  rË  )r(   s    r6   Ú_get_multicapturerØ  Æ  sœ   € Ø�ƒ~Ü¤	¨!£´)¸A³,ÄIÈaÃLÑQÐQØ	�5‹Ü¤
¨1£´:¸a³=ÄjÐQRÃmÑTÐTØ	�4‹Ü ¨$°DÑ9Ð9Ø	�9Ó	ÜØœ* Q¨DÑ1´zÀ!ÈÑ7Nñ
ð 	
ô Ð1°&±Ð<Ó
=Ð=r8   c                  óÊ  • \ rS rSrSrS!S jrS"S jrS#S jrS$S jrS%S jr	S%S jr
S%S	 jrS&S'S
 jjrS&S'S jjrS%S jrS(S jrS)S jrS%S jrS%S jrS%S jrS%S jrS%S jr\R.                  S*S j5       r\R.                  S+S j5       r\" SS9    S,S j5       r\" SS9S-S j5       r\" SS9S-S j5       r\" SS9S-S j5       r\" SS9S%S j5       r\" SS9S%S j5       r Sr!g ).rk   i×  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.
c                ó,   • Xl         S U l        S U l        g r   ©Ú_methodÚ_global_capturingÚ_capture_fixture)r‚   r(   s     r6   rœ   ÚCaptureManager.__init__ê  s   € Ø$ŒØ;?ˆÔØ<@ˆÕr8   c                ó\   • SU R                   < SU R                  < SU R                  < S3$ )Nz<CaptureManager _method=z _global_capturing=z _capture_fixture=r�  rÛ  r�   s    r6   rK  ÚCaptureManager.__repr__ï  s:   € à& t§|¡|Ñ&6Ð6IÈ$×J`ÑJ`ÑIcð d Ø $× 5Ñ 5Ñ8¸ð;ð	
r8   c                ó˜   • U R                  5       (       a  gU R                  (       a#  SU R                  R                  R                   3$ g)NÚglobalzfixture F)Úis_globally_capturingrÞ  ÚrequestÚfixturenamer�   s    r6   Úis_capturingÚCaptureManager.is_capturingõ  s@   € Ø×%Ñ%×'Ñ'ØØ× × Ø˜d×3Ñ3×;Ñ;×GÑGÐHÐIÐIØr8   c                ó    • U R                   S:g  $ )Nr#   )rÜ  r�   s    r6   rä  Ú$CaptureManager.is_globally_capturingþ  s   € Ø�|‰|˜tÑ#Ð#r8   c                óŠ   • U R                   b   e[        U R                  5      U l         U R                   R                  5         g r   )rÝ  rØ  rÜ  r»  r�   s    r6   ro   Ú%CaptureManager.start_global_capturing  s7   € Ø×%Ñ%Ñ-Ð-Ð-Ü!2°4·<±<Ó!@ˆÔØ×Ñ×.Ñ.Õ0r8   c                ó–   • U R                   b<  U R                   R                  5         U R                   R                  5         S U l         g g r   )rÝ  rÀ  rÌ  r�   s    r6   rn   Ú$CaptureManager.stop_global_capturing  s?   € Ø×!Ñ!Ñ-Ø×"Ñ"×5Ñ5Ô7Ø×"Ñ"×1Ñ1Ô3Ø%)ˆDÕ"ð .r8   c                óT   • U R                   b  U R                   R                  5         g g r   )rÝ  rÇ  r�   s    r6   Úresume_global_captureÚ$CaptureManager.resume_global_capture  s'   € ð ×!Ñ!Ñ-Ø×"Ñ"×3Ñ3Õ5ð .r8   c                óR   • U R                   b  U R                   R                  US9  g g )N©rµ  )rÝ  rÄ  rÃ  s     r6   rp   Ú%CaptureManager.suspend_global_capture  s*   € Ø×!Ñ!Ñ-Ø×"Ñ"×4Ñ4¸Ð4Ò=ð .r8   c                óF   • U R                  5         U R                  U5        g r   )Úsuspend_fixturerp   rÃ  s     r6   r  ÚCaptureManager.suspend  s   € à×ÑÔØ×#Ñ# CÕ(r8   c                óD   • U R                  5         U R                  5         g r   )rð  Úresume_fixturer�   s    r6   r  ÚCaptureManager.resume  s   € Ø×"Ñ"Ô$Ø×ÑÕr8   c                óT   • U R                   c   eU R                   R                  5       $ r   )rÝ  r¾  r�   s    r6   rr   Ú"CaptureManager.read_global_capture  s)   € Ø×%Ñ%Ñ1Ð1Ð1Ø×%Ñ%×0Ñ0Ó2Ð2r8   c                óâ   • U R                   (       aX  U R                   R                  R                  nUR                  R                  nUR                  R                  SU SU S35        Xl         g )Nzcannot use z and z at the same time)rÞ  rå  ræ  Ú
raiseerror)r‚   Úcapture_fixtureÚcurrent_fixtureÚrequested_fixtures       r6   Úset_fixtureÚCaptureManager.set_fixture%  sf   € Ø× × Ø"×3Ñ3×;Ñ;×GÑGˆOØ /× 7Ñ 7× CÑ CÐØ×#Ñ#×.Ñ.ØÐ/Ð0°°oÐ5FÐFWÐXôð !0Õr8   c                ó   • S U l         g r   )rÞ  r�   s    r6   Úunset_fixtureÚCaptureManager.unset_fixture.  s
   € Ø $ˆÕr8   c                ó\   • U R                   (       a  U R                   R                  5         gg)ztIf the current item is using ``capsys`` or ``capfd``, activate
them so they take precedence over the global capture.N)rÞ  Ú_startr�   s    r6   Úactivate_fixtureÚCaptureManager.activate_fixture1  s$   € ð × × Ø×!Ñ!×(Ñ(Õ*ð !r8   c                ó\   • U R                   (       a  U R                   R                  5         gg)zDDeactivate the ``capsys`` or ``capfd`` fixture of this item, if any.N)rÞ  rØ   r�   s    r6   Údeactivate_fixtureÚ!CaptureManager.deactivate_fixture7  s"   € à× × Ø×!Ñ!×'Ñ'Õ)ð !r8   c                ó\   • U R                   (       a  U R                   R                  5         g g r   )rÞ  Ú_suspendr�   s    r6   rö  ÚCaptureManager.suspend_fixture<  s"   € Ø× × Ø×!Ñ!×*Ñ*Õ,ð !r8   c                ó\   • U R                   (       a  U R                   R                  5         g g r   )rÞ  Ú_resumer�   s    r6   rù  ÚCaptureManager.resume_fixture@  s"   € Ø× × Ø×!Ñ!×)Ñ)Õ+ð !r8   c              #  óì  #   • U R                   =(       a    U R                   R                  5       nU(       a  U R                  5         U R                  =(       a    U R                  R	                  5       nU(       a  U R                  5          Sv •  U(       a  U R                  5         U(       a  U R                  5         gg! U(       a  U R                  5         U(       a  U R                  5         f f = f7f)zLContext manager to temporarily disable global and current fixture capturing.N)rÞ  Ú_is_startedrö  rÝ  rÏ  rp   rð  rù  )r‚   Ú
do_fixtureÚ	do_globals      r6   Úglobal_and_fixture_disabledÚ*CaptureManager.global_and_fixture_disabledF  s´   é € ð ×*Ñ*×R¨t×/DÑ/D×/PÑ/PÓ/Rˆ
ÞØ× Ñ Ô"Ø×*Ñ*×R¨t×/EÑ/E×/PÑ/PÓ/Rˆ	ÞØ×'Ñ'Ô)ð	&ÛæØ×*Ñ*Ô,ÞØ×#Ñ#Õ%ð øö Ø×*Ñ*Ô,ÞØ×#Ñ#Õ%ð üs   ‚B	C4ÂC  Â0C4Ã 1C1Ã1C4c              #  ó¼  #   • U R                  5         U R                  5          S v •  U R                  5         U R                  SS9  U R	                  5       u  p4UR                  USU5        UR                  USU5        g ! U R                  5         U R                  SS9  U R	                  5       u  p4UR                  USU5        UR                  USU5        f = f7f)NFró  ra   rb   )rð  r	  r  rp   rr   Úadd_report_section)r‚   ÚwhenÚitemrw   rx   s        r6   Úitem_captureÚCaptureManager.item_captureW  sÊ   é € à×"Ñ"Ô$Ø×ÑÔð	9Ûà×#Ñ#Ô%Ø×'Ñ'¨EÐ'Ñ2à×/Ñ/Ó1‰HˆCØ×#Ñ# D¨(°CÔ8Ø×#Ñ# D¨(°CÕ8øð ×#Ñ#Ô%Ø×'Ñ'¨EÐ'Ñ2à×/Ñ/Ó1‰HˆCØ×#Ñ# D¨(°CÔ8Ø×#Ñ# D¨(°CÕ8üs   ‚!C¤B  ¨ACÂ ACÃCTre   c              #  ól  #   • [        U[        5      (       a�  U R                  5          S v •nU R                  5         U R	                  5       u  p4U(       a  UR
                  R                  SU45        U(       a  UR
                  R                  SU45        U$ S v •nU$ ! U R                  5         f = f7f)NzCaptured stdoutzCaptured stderr)r^   r   rð  rp   rr   ÚsectionsÚappend)r‚   Ú	collectorÚreprw   rx   s        r6   Úpytest_make_collect_reportÚ)CaptureManager.pytest_make_collect_reportg  sž   é € ô �i¤×&Ñ&Ø×&Ñ&Ô(ð.Ú�à×+Ñ+Ô-Ø×/Ñ/Ó1‰HˆCÞØ—‘×#Ñ#Ð%6¸Ð$<Ô=ÞØ—‘×#Ñ#Ð%6¸Ð$<Ô=ð ˆ
ò ˆCØˆ
øð ×+Ñ+Õ-üs   ‚&B4©B ­A2B4ÂB1Â1B4c              #  ól   #   • U R                  SU5         S v •sS S S 5        $ ! , (       d  f       g = f7f)NÚsetup©r  ©r‚   r  s     r6   Úpytest_runtest_setupÚ#CaptureManager.pytest_runtest_setupz  s#   é € à×Ñ˜w¨Õ-Ú÷ .×-×-üó   ‚4•#™
4£
1­4c              #  ól   #   • U R                  SU5         S v •sS S S 5        $ ! , (       d  f       g = f7f)NÚcallr)  r*  s     r6   Úpytest_runtest_callÚ"CaptureManager.pytest_runtest_call  s#   é € à×Ñ˜v tÕ,Ú÷ -×,×,ür-  c              #  ól   #   • U R                  SU5         S v •sS S S 5        $ ! , (       d  f       g = f7f)NÚteardownr)  r*  s     r6   Úpytest_runtest_teardownÚ&CaptureManager.pytest_runtest_teardown„  s#   é € à×Ñ˜z¨4Õ0Ú÷ 1×0×0ür-  )Útryfirstc                ó$   • U R                  5         g r   ©rn   r�   s    r6   Úpytest_keyboard_interruptÚ(CaptureManager.pytest_keyboard_interrupt‰  ó   € à×"Ñ"Õ$r8   c                ó$   • U R                  5         g r   r8  r�   s    r6   Úpytest_internalerrorÚ#CaptureManager.pytest_internalerror�  r;  r8   )rÞ  rÝ  rÜ  N)r(   Ú_CaptureMethodr‹   r¥   rŠ   )r‹   z
str | boolr  r¤   rÔ  rÕ  )r‹   zCaptureResult[str])rÿ  zCaptureFixture[Any]r‹   r¥   ©r‹   úGenerator[None])r  rŒ   r  r   r‹   rA  )r#  r   r‹   z-Generator[None, CollectReport, CollectReport])r  r   r‹   rA  )"r�   rŽ   r�   r�   r£  rœ   rK  rç  rä  ro   rn   rð  rp   r  r  rr   r  r  r	  r  rö  rù  Ú
contextlibÚcontextmanagerr  r  r   r%  r+  r0  r4  r9  r=  r“   r}   r8   r6   rk   rk   ×  s7  † ñô$Aô

ôô$ô1ô
*ô6ö>ö)ô
ô3ô0ô%ô+ô*ô
-ô,ð ×Ñó&ó ð&ð  ×Ñó9ó ð9ñ �dÑðØ"ðà	6óó ðñ$ �dÑóó ðñ �dÑóó ðñ �dÑóó ðñ �tÑó%ó ð%ñ �tÑó%ó ó%r8   rk   c                  óœ   • \ rS rSrSrSS.       SS jjrSS jrSS jrSS jrSS	 jr	SS
 jr
SS jr\R                  SS j5       rSrg)ÚCaptureFixturei’  zxObject returned by the :fixture:`capsys`, :fixture:`capsysbinary`,
:fixture:`capfd` and :fixture:`capfdbinary` fixtures.F©Ú	_ispytestc               ó¬   • [        U5        Xl        X l        S U l        U R                  R                  U l        U R                  R                  U l        g r   )r   Úcaptureclassrå  Ú_capturer  Ú_captured_outÚ_captured_err)r‚   rI  rå  rG  s       r6   rœ   ÚCaptureFixture.__init__–  sF   € ô 	�yÔ!Ø7CÔØŒØ59ˆŒØ%)×%6Ñ%6×%CÑ%CˆÔØ%)×%6Ñ%6×%CÑ%CˆÕr8   c                ó°   • U R                   cI  [        S U R                  S5      U R                  S5      S9U l         U R                   R                  5         g g )Nr%  r&  r´  )rJ  r²  rI  r»  r�   s    r6   r  ÚCaptureFixture._start¤  sN   € Ø�=‰=Ñ Ü(ØØ×%Ñ% aÓ(Ø×%Ñ% aÓ(ñˆDŒMð
 �M‰M×)Ñ)Õ+ð !r8   c                óî   • U R                   bh  U R                   R                  5       u  pU =R                  U-  sl        U =R                  U-  sl        U R                   R	                  5         S U l         g g r   )rJ  rÀ  rK  rL  rÌ  r¿  s      r6   rØ   ÚCaptureFixture.close­  s^   € Ø�=‰=Ñ$Ø—}‘}×7Ñ7Ó9‰HˆCØ×Ò #Ñ%ÕØ×Ò #Ñ%ÕØ�M‰M×(Ñ(Ô*Ø ˆD�Mð %r8   c                ó  • U R                   U R                  p!U R                  b$  U R                  R                  5       u  p4X-  nX$-  nU R                  R
                  U l         U R                  R
                  U l        [        X5      $ )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.
)rK  rL  rJ  r¾  rI  r  r®  )r‚   Úcaptured_outÚcaptured_errrw   rx   s        r6   r¾  ÚCaptureFixture.readouterrµ  sx   € ð &*×%7Ñ%7¸×9KÑ9K�lØ�=‰=Ñ$Ø—}‘}×/Ñ/Ó1‰HˆCØÑˆLØÑˆLØ!×.Ñ.×;Ñ;ˆÔØ!×.Ñ.×;Ñ;ˆÔÜ˜\Ó8Ð8r8   c                óT   • U R                   b  U R                   R                  5         gg)z1Suspend this fixture's own capturing temporarily.N)rJ  rÄ  r�   s    r6   r  ÚCaptureFixture._suspendÆ  s!   € à�=‰=Ñ$Ø�M‰M×+Ñ+Õ-ð %r8   c                óT   • U R                   b  U R                   R                  5         gg)z0Resume this fixture's own capturing temporarily.N)rJ  rÇ  r�   s    r6   r  ÚCaptureFixture._resumeË  s!   € à�=‰=Ñ$Ø�M‰M×*Ñ*Õ,ð %r8   c                óR   • U R                   b  U R                   R                  5       $ g)z5Whether actively capturing -- not disabled or closed.F)rJ  rÏ  r�   s    r6   r  ÚCaptureFixture._is_startedÐ  s"   € à�=‰=Ñ$Ø—=‘=×+Ñ+Ó-Ð-Ør8   c              #  óÆ   #   • U R                   R                  R                  R                  S5      nUR	                  5          Sv •  SSS5        g! , (       d  f       g= f7f)z>Temporarily disable capturing while inside the ``with`` block.rh   N)rå  Úconfigrj   Ú	getpluginr  )r‚   Ú
capmanagers     r6   ÚdisabledÚCaptureFixture.disabledÖ  sF   é € ð &*§\¡\×%8Ñ%8×%FÑ%F×%PÑ%PØó&
ˆ
ð ×3Ñ3Õ5Û÷ 6×5Ö5üs   ‚A A!ÁAÁ	A!Á
AÁA!)rJ  rL  rK  rI  rå  N)rI  ztype[CaptureBase[AnyStr]]rå  r   rG  r  r‹   r¥   r¤   rÖ  r  r@  )r�   rŽ   r�   r�   r£  rœ   r  rØ   r¾  r  r  r  rB  rC  r`  r“   r}   r8   r6   rE  rE  ’  st   † ñ=ð  ñDà/ðDð ðDð
 ðDð 
õDô,ô!ô9ô".ô
-ô
ð ×Ñóó ór8   rE  c              #  óþ   #   • U R                   R                  R                  S5      n[        [        U SS9nUR                  U5        UR                  5         Uv •  UR                  5         UR                  5         g7f)aä  Enable 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"
rh   TrF  N)	r]  rj   r^  rE  ry  r  r  rØ   r  ©rå  rv   rÿ  s      r6   Úcapsysrd  ã  sh   é € ð& %Ÿ^™^×9Ñ9×CÑCÐDTÓU€FÜ$¤Z°ÀDÑI€OØ
×Ñ�Ô'Ø×ÑÔØ
ÒØ×ÑÔØ
×ÑÕùó   ‚A;A=c              #  óþ   #   • U R                   R                  R                  S5      n[        [        U SS9nUR                  U5        UR                  5         Uv •  UR                  5         UR                  5         g7f)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"
rh   TrF  N)	r]  rj   r^  rE  ri  r  r  rØ   r  rc  s      r6   Úcapsysbinaryrg  ÿ  si   é € ð& %Ÿ^™^×9Ñ9×CÑCÐDTÓU€FÜ$Ô%5°wÈ$ÑO€OØ
×Ñ�Ô'Ø×ÑÔØ
ÒØ×ÑÔØ
×ÑÕùre  c              #  óþ   #   • U R                   R                  R                  S5      n[        [        U SS9nUR                  U5        UR                  5         Uv •  UR                  5         UR                  5         g7f)að  Enable 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"
rh   TrF  N)	r]  rj   r^  rE  r¥  r  r  rØ   r  rc  s      r6   Úcapfdri    sh   é € ð& %Ÿ^™^×9Ñ9×CÑCÐDTÓU€FÜ$¤Y°À4ÑH€OØ
×Ñ�Ô'Ø×ÑÔØ
ÒØ×ÑÔØ
×ÑÕùre  c              #  óþ   #   • U R                   R                  R                  S5      n[        [        U SS9nUR                  U5        UR                  5         Uv •  UR                  5         UR                  5         g7f)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"

rh   TrF  N)	r]  rj   r^  rE  rœ  r  r  rØ   r  rc  s      r6   Úcapfdbinaryrk  7  sh   é € ð( %Ÿ^™^×9Ñ9×CÑCÐDTÓU€FÜ$¤_°gÈÑN€OØ
×Ñ�Ô'Ø×ÑÔØ
ÒØ×ÑÔØ
×ÑÕùre  )r4   r   r‹   r¥   r¤   )rY   r   r‹   r¥   )rt   r   r‹   rA  )r(   r?  r‹   zMultiCapture[str])rå  r   r‹   zGenerator[CaptureFixture[str]])rå  r   r‹   z Generator[CaptureFixture[bytes]])Pr£  Ú
__future__r   r#  ÚcollectionsrB  rL   r   rO   r"   Útempfiler   Útypesr   Útypingr   r	   r
   r   r   r   r   r   r   r   r   r   r   Útyping_extensionsr   Ú_pytest.configr   r   Ú_pytest.config.argparsingr   Ú_pytest.deprecatedr   Ú_pytest.fixturesr   r   Ú_pytest.nodesr   r   r   Ú_pytest.reportsr   r?  r7   r?   rC   rd   ry   rM   r{   r•   r©   r´   ÚABCr  r?  rŒ   r(  r:  ru  ri  ry  r  rœ  r¥  Úversion_infor®  Ú
namedtupler²  rØ  rk   rE  rd  rg  ri  rk  r}   r8   r6   Ú<module>r{     sm  ðá 1å "ã 
Û Û Û 	Ý #Û 	Û 
Ý "Ý Ý Ý Ý Ý Ý Ý Ý Ý Ý Ý Ý Ý Ý  ö Ý&å !Ý #Ý ,Ý -Ý $Ý 'Ý #Ý Ý Ý )ð Ð5Ñ6€ôô&ôô"41ñn 
�$Ñóó ðô<1�"×"Ñ"ô 1ô 6�× Ñ ô 6ô$�9ô $ôJ˜ô Jô`$�#—'‘'˜7 6™?ô $ð@ ˜x¨HÑ5€ô�˜CÑ ô ô2@ �[ Ñ(ô @ ôF!�~ eÑ,ô !ô$� Ñ$ô ô"\ �K Ñ'ô \ ô~+�m EÑ*ô +ô,;�˜cÑ"ô ;ð6 ×Ñ�wÓ¦-à
ô˜
 G¨F¡Oó ó ñôØ×Ò˜°¸°Ó?Ø�‰ôôQ'�7˜6‘?ô Q'ôh>÷"x%ñ x%ôvK�W˜V‘_ô Kðb 	óó 	ðð6 	óó 	ðð6 	óó 	ðð6 	óó 	ñr8   