
^Yc           @` s  d  Z  d d l m Z m Z m Z d d l Z d d l Z d d l Z d d l Z d d l m	 Z	 d d l
 m Z d d l Z d d l Z d d l m Z e j j Z i d d 6d d	 6d
 d 6Z d   Z e j d e  d    Z d d& d     YZ d Z e j d    Z e j d    Z d d' d     YZ d d  Z d e f d     YZ  d e f d     YZ! d d( d     YZ" d d) d     YZ# d  d* d!     YZ$ d" d+ d#     YZ% d$   Z& d%   Z' d S(,   s.   
per-test stdout/stderr capturing mechanism.

i    (   t   absolute_importt   divisiont   print_functionN(   t   UnsupportedOperation(   t   TemporaryFile(   t	   CaptureIOt   stdint   stdouti   t   stderri   c         C` s   |  j  d  } | j d d d d t t d  r6 d n d d	 d
 d d d d g d d | j d d d d d d d d d d  S(   Nt   generals	   --capturet   actiont   storet   defaultt   dupt   fdt   syst   metavart   methodt   choicest   not   helps,   per-test capturing method: one of fd|sys|no.s   -st   store_constt   constt   destt   captures   shortcut for --capture=no.(   t   getgroupt
   _addoptiont   hasattrt   os(   t   parsert   group(    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   pytest_addoption   s    t   hookwrapperc   
      c` s   |  j  } | j d k r" t   n  t   |  j } t | j  } | j | d  |  j | j  d   } |  j |  | j	   d  V} | j
   \ } }	 | j d  k	 r t j j |  t j j |	  n  d  S(   NR   t   capturemanagerc           S` s&   d t  j k r" t t  j d _ n  d  S(   Nt   logging(   R   t   modulest   Falset   raiseExceptions(    (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   silence_logging_at_shutdown1   s    (   t   known_args_namespaceR   t!   _py36_windowsconsoleio_workaroundt   _readline_workaroundt   pluginmanagert   CaptureManagert   registert   add_cleanupt   reset_capturingst   init_capturingst   suspendcapturet   excinfot   NoneR   R   t   writeR   (
   t   early_configR   t   argst   nsR*   t   capmanR&   t   outcomet   outt   err(    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   pytest_load_initial_conftests#   s     	
		
R+   c           B` s  e  Z d    Z d   Z d   Z d   Z d   Z e d  Z d   Z	 d   Z
 e j d e  d	    Z e j d e  d
    Z e j d e  d    Z e j d e  d    Z e j d e  d    Z e j d e  d    Z e d  Z RS(   c         C` s   | |  _  d  S(   N(   t   _method(   t   selfR   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   __init__@   s    c         C` s   | d k r% t  d t d t d t  S| d k rJ t  d t d t d t  S| d k ro t  d t d t d t  St d |   d  S(	   NR   R9   R:   t   CaptureR   R   t   in_s   unknown capturing method: %r(   t   MultiCapturet   Truet	   FDCapturet
   SysCaptureR$   t
   ValueError(   R=   R   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   _getcaptureC   s    c         C` s<   t  |  d  s t  |  j |  j  |  _ |  j j   d  S(   Nt
   _capturing(   R   t   AssertionErrorRF   R<   RG   t   start_capturing(   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR/   M   s    c         C` s<   |  j  j d d   } | d  k	 r8 | j   | j   n  d  S(   NRG   (   t   __dict__t   popR2   t   pop_outerr_to_origt   stop_capturing(   R=   t   cap(    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR.   R   s    
c         C` s   |  j  j   d  S(   N(   RG   t   resume_capturing(   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   resumecaptureX   s    c         C` sT   |  j    t |  d d   } | d  k	 rP z | j   } Wd  | j d |  X| Sd  S(   NRG   R@   (   t   deactivate_funcargst   getattrR2   t
   readouterrt   suspend_capturing(   R=   R@   RN   t   outerr(    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR0   [   s    
c         C` s;   | j  j d d   } | d  k	 r7 | j   | |  _ n  d  S(   Nt   _capfuncarg(   RJ   RK   R2   t   _startRV   (   R=   t
   pyfuncitemt
   capfuncarg(    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   activate_funcargse   s    
c         C` s2   |  j  j d d   } | d  k	 r. | j   n  d  S(   NRV   (   RJ   RK   R2   t   close(   R=   RY   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRQ   k   s    R    c         c` s   t  | t j  r |  j   d  V} |  j   \ } } | j   } | r` | j j d | f  n  | r | j j d | f  q n d  Vd  S(   Ns   Captured stdouts   Captured stderr(   t
   isinstancet   pytestt   FileRP   R0   t
   get_resultt   sectionst   append(   R=   t	   collectorR8   R9   R:   t   rep(    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   pytest_make_collect_reportp   s    
c         c` s#   |  j    d  V|  j | d  d  S(   Nt   setup(   RP   t   suspendcapture_item(   R=   t   item(    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   pytest_runtest_setup~   s    
c         c` s0   |  j    |  j |  d  V|  j | d  d  S(   Nt   call(   RP   RZ   Rf   (   R=   Rg   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   pytest_runtest_call   s    
c         c` s#   |  j    d  V|  j | d  d  S(   Nt   teardown(   RP   Rf   (   R=   Rg   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   pytest_runtest_teardown   s    
t   tryfirstc         C` s   |  j    d  S(   N(   R.   (   R=   R1   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   pytest_keyboard_interrupt   s    c         C` s   |  j    d  S(   N(   R.   (   R=   R1   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   pytest_internalerror   s    c         C` sB   |  j  d |  \ } } | j | d |  | j | d |  d  S(   NR@   R   R   (   R0   t   add_report_section(   R=   Rg   t   whenR@   R9   R:   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRf      s    (   t   __name__t
   __module__R>   RF   R/   R.   RP   R$   R0   RZ   RQ   R]   t   hookimplRB   Rd   Rh   Rj   Rl   Rn   Ro   Rf   (    (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR+   ?   s   		
			
		s,   cannot use capsys and capfd at the same timec         C` s>   d |  j  k r! |  j t   n  t t |   |  j _ } | S(   s   Enable capturing of writes to sys.stdout/sys.stderr and make
    captured output available via ``capsys.readouterr()`` method calls
    which return a ``(out, err)`` tuple.
    t   capfd(   t   fixturenamest
   raiseerrort   error_capsysfderrort   CaptureFixtureRD   t   nodeRV   (   t   requestt   c(    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   capsys   s    c         C` s[   d |  j  k r |  j t  n  t t d  s> t j d  n  t t |   |  j	 _
 } | S(   s   Enable capturing of writes to file descriptors 1 and 2 and make
    captured output available via ``capfd.readouterr()`` method calls
    which return a ``(out, err)`` tuple.
    R}   R   s   capfd funcarg needs os.dup(   Rv   Rw   Rx   R   R   R]   t   skipRy   RC   Rz   RV   (   R{   R|   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRu      s    Ry   c           B` s>   e  Z d    Z d   Z d   Z d   Z e j d    Z RS(   c         C` s   | |  _  | |  _ d  S(   N(   t   captureclassR{   (   R=   R   R{   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR>      s    	c      	   C` s8   t  d t d t d t d |  j  |  _ |  j j   d  S(   NR9   R:   R@   R?   (   RA   RB   R$   R   t   _captureRI   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRW      s    c         C` sA   |  j  j d d   } | d  k	 r= | j   |  _ | j   n  d  S(   NR   (   RJ   RK   R2   RL   t   _outerrRM   (   R=   RN   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR[      s    c         C` s-   y |  j  j   SWn t k
 r( |  j SXd  S(   N(   R   RS   t   AttributeErrorR   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRS      s    c         c` sO   |  j  j j j d  } | j |  j  j d d t z	 d  VWd  | j   Xd  S(   NR!   Ri   R@   (   R{   t   configR*   t	   getpluginRf   Rz   RB   RP   (   R=   t
   capmanager(    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   disabled   s
    	(	   Rr   Rs   R>   RW   R[   RS   t
   contextlibt   contextmanagerR   (    (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRy      s
   				t   UTF8c         C` s   t  |  d d  } y |  j   } Wn< t k
 r` d t  |  d d  k r t |  d  r |  Sn> Xt j |  } d | k r | d 7} n  t j | | d  }  t |  | p |  S(   sa    return a open text file object that's a duplicate of f on the
        FD-level if possible.
    t   encodingt   bt   modet    i    N(	   RR   R2   t   filenot	   ExceptionR   R   R   t   fdopent   EncodedFile(   t   fR   t   default_encodingR   R   t   newfd(    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   safe_text_dupfile   s    'R   c           B` s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   t   strictc         C` s   | |  _  | |  _ d  S(   N(   t   bufferR   (   R=   R   R   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR>      s    	c         C` s;   t  | t  r' | j |  j d  } n  |  j j |  d  S(   Nt   replace(   R\   t   unicodet   encodeR   R   R3   (   R=   t   obj(    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR3      s    c         C` s    d j  |  } |  j |  d  S(   NR   (   t   joinR3   (   R=   t   linelistt   data(    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt
   writelines   s    c         C` s   t  t j |  d  |  S(   NR   (   RR   t   objectt   __getattribute__(   R=   t   name(    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   __getattr__   s    (   Rr   Rs   t   errorsR>   R3   R   R   (    (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR      s
   			RA   c           B` sd   e  Z d Z Z Z e e e d d   Z d   Z d   Z	 e
 d  Z d   Z d   Z d   Z RS(   c         C` sL   | r | d  |  _  n  | r0 | d  |  _ n  | rH | d  |  _ n  d  S(   Ni    i   i   (   R@   R9   R:   (   R=   R9   R:   R@   R?   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR>     s    c         C` sO   |  j  r |  j  j   n  |  j r2 |  j j   n  |  j rK |  j j   n  d  S(   N(   R@   t   startR9   R:   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRI     s    			c         C` sN   |  j    \ } } | r+ |  j j |  n  | rD |  j j |  n  | | f S(   sA    pop current snapshot out/err capture and flush to orig streams. (   RS   R9   t   writeorgR:   (   R=   R9   R:   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRL     s    c         C` s^   |  j  r |  j  j   n  |  j r2 |  j j   n  | rZ |  j rZ |  j j   t |  _ n  d  S(   N(   R9   t   suspendR:   R@   RB   t   _in_suspended(   R=   R@   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRT     s    		c         C` s[   |  j  r |  j  j   n  |  j r2 |  j j   n  t |  d  rW |  j j   |  ` n  d  S(   NR   (   R9   t   resumeR:   R   R@   R   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRO   '  s    		c         C` sv   t  |  d  r t d   n  t |  _ |  j r@ |  j j   n  |  j rY |  j j   n  |  j rr |  j j   n  d S(   s,    stop capturing and reset capturing streams t   _resets   was already stoppedN(   R   RE   RB   R   R9   t   doneR:   R@   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRM   0  s    				c         C` sF   |  j  d k	 r |  j  j   n d |  j d k	 r? |  j j   n d f S(   s<    return snapshot unicode value of stdout/stderr capturings. R   N(   R9   R2   t   snapR:   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRS   <  s    !N(   Rr   Rs   R2   R9   R:   R@   RB   R>   RI   RL   R$   RT   RO   RM   RS   (    (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRA     s   							t	   NoCapturec           B` s!   e  Z d    Z Z Z Z Z RS(   c          G` s   d  S(   N(   R2   (   R5   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   <lambda>B  s    (   Rr   Rs   R>   R   R   R   R   (    (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR   A  s   RC   c           B` sY   e  Z d  Z d	 d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z RS(
   s5    Capture IO to/from a given os-level filedescriptor. c         C` s  | |  _  y t j |  j   |  _ Wn) t k
 rM d   |  _ d   |  _ n X| d k r | sm t d   t t j	 d  } t
 |  |  _ nd | d  k r t   } |  t | d d } Wd  QXn  | t k r t
 | |  |  _ n t   |  _ | |  _ | j   |  _ d  S(   Nc           S` s   d  S(   N(   R2   (    (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR   L  s    c           S` s   d  S(   N(   R2   (    (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR   M  s    i    s   cannot set tmpfile with stdint   rR   s   wb+(   t   targetfdR   R   t   targetfd_savet   OSErrorR   R   RH   t   opent   devnullRD   t
   syscaptureR2   R   R   t   patchsysdictR   t   tmpfileR   t
   tmpfile_fd(   R=   R   R   R   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR>   G  s&    			c         C` s   d |  j  |  j f S(   Ns   <FDCapture %s oldfd=%s>(   R   R   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   __repr___  s    c         C` sa   y t  j |  j  Wn# t t f k
 r9 t d   n Xt  j |  j |  j  |  j	 j
   d S(   s6    Start capturing on targetfd using memorized tmpfile. s&   saved filedescriptor not valid anymoreN(   R   t   fstatR   R   R   RE   t   dup2R   R   R   R   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR   b  s    c         C` s   |  j  } | j d  | j   } | r t | d d   } | rj t | t  rj t j j	 | | d  } n  | j
 d  | j d  | Sd S(   Ni    R   R   R   (   R   t   seekt   readRR   R2   R\   t   bytest   pyt   builtint   _totextt   truncate(   R=   R   t   rest   enc(    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR   k  s    	c         C` sP   |  j  j d  } t j | |  j  t j |  |  j j   |  j j   d S(   sa    stop capturing, restore streams, return original capture file,
        seeked to position zero. R   N(	   RJ   RK   R   R   R   R[   R   R   R   (   R=   R   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR   x  s
    c         C` s'   |  j  j   t j |  j |  j  d  S(   N(   R   R   R   R   R   R   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR     s    c         C` s'   |  j  j   t j |  j |  j  d  S(   N(   R   R   R   R   R   R   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR     s    c         C` s;   t  j j |  r$ | j d  } n  t j |  j |  d S(   s$    write to original file descriptor. t   utf8N(   R   R   t   _istextR   R   R3   R   (   R=   R   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR     s    N(   Rr   Rs   t   __doc__R2   R>   R   R   R   R   R   R   R   (    (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRC   D  s   								RD   c           B` sJ   e  Z d d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   c         C` sb   t  | } t t |  |  _ | |  _ | d  k rU | d k rI t   } qU t   } n  | |  _ d  S(   NR   (	   R   RR   R   t   _oldR   R2   t   DontReadFromInputR   R   (   R=   R   R   R   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR>     s    
	c         C` s   t  t |  j |  j  d  S(   N(   t   setattrR   R   R   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR     s    c         C` s3   |  j  } | j   } | j d  | j d  | S(   Ni    (   R   t   getvalueR   R   (   R=   R   R   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR     s
    	c         C` s-   t  t |  j |  j  |  ` |  j j   d  S(   N(   R   R   R   R   R   R[   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR     s    c         C` s   t  t |  j |  j  d  S(   N(   R   R   R   R   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR     s    c         C` s   t  t |  j |  j  d  S(   N(   R   R   R   R   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR     s    c         C` s!   |  j  j |  |  j  j   d  S(   N(   R   R3   t   flush(   R=   R   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR     s    N(
   Rr   Rs   R2   R>   R   R   R   R   R   R   (    (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyRD     s   					R   c           B` sY   e  Z d  Z d Z d   Z e Z e Z e Z d   Z	 d   Z
 d   Z e d    Z RS(   s  Temporary stub class.  Ideally when stdin is accessed, the
    capturing should be turned off, with possibly all data captured
    so far sent to the screen.  This should be configurable, though,
    because in automated test runs it is better to crash than
    hang indefinitely.
    c         G` s   t  d   d  S(   Ns+   reading from stdin while output is captured(   t   IOError(   R=   R5   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR     s    c         C` s   t  d   d  S(   Ns/   redirected stdin is pseudofile, has no fileno()(   R   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR     s    c         C` s   t  S(   N(   R$   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   isatty  s    c         C` s   d  S(   N(    (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR[     s    c         C` s#   t  j d k r |  St d   d  S(   Ni   i    s(   redirected stdin has no attribute buffer(   i   i    (   R   t   version_infoR   (   R=   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR     s    N(   Rr   Rs   R   R2   R   R   t   readlinet	   readlinest   __iter__R   R   R[   t   propertyR   (    (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR     s   				c          C` s>   t  j j d  s d Sy d d l }  Wn t k
 r9 n Xd S(   sF  
    Ensure readline is imported so that it attaches to the correct stdio
    handles on Windows.

    Pdb uses readline support where available--when not running from the Python
    prompt, the readline module is not imported until running the pdb REPL.  If
    running pytest with the --pdb option this means the readline module is not
    imported until after I/O capture has been started.

    This is a problem for pyreadline, which is often used to implement readline
    support on Windows, as it does not attach to the correct handles for stdout
    and/or stdin if they have been redirected by the FDCapture mechanism.  This
    workaround ensures that readline is imported before I/O capture is setup so
    that it can attach to the actual stdin/out for the console.

    See https://github.com/pytest-dev/pytest/pull/1281
    t   win32Ni    (   R   t   platformt
   startswithR   t   ImportError(   R   (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR)     s    c          ` s   t  j j d  s& t  j d  d
 k  r* d St t  j j d      rT t  j j j n	 t  j j }  t |  t	 j
  sv d S  f d   } | t  j d  t  _ t  _ | t  j d	  t  _ t  _ | t  j d	  t  _ t  _ d S(   s?  
    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".

    See https://github.com/pytest-dev/py/issues/103
    R   i   i   i   Nt   rawc         ` sf     r  | d d k r  d } n d } t  j t t j |  j    | |  |  j |  j |  j |  j	  S(   Ni    t   wi(
   t   iot   TextIOWrapperR   R   R   R   R   R   t   newlinest   line_buffering(   R   R   t	   buffering(   t   buffered(    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   _reopen_stdio  s    	t   rbt   wb(   i   i   (   R   R   R   R   R   R   R   R   R\   R   t   _WindowsConsoleIOR   t	   __stdin__t
   __stdout__R   t
   __stderr__(   t
   raw_stdoutR   (    (   R   s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyR(     s    &!(    (    (    (    (    (    ((   R   t
   __future__R    R   R   R   R   R   R   R   t   tempfileR   R   R]   t   _pytest.compatR   R   t   textR   R   R   Rt   RB   R;   R+   Rx   t   fixtureR}   Ru   Ry   R   R   R   RA   R   RC   RD   R   R)   R(   (    (    (    s/   /tmp/pip-build-hU8Cw8/pytest/_pytest/capture.pyt   <module>   s8   	a ?L&"	