
i\c           @` s  d  Z  d d l m Z d d l m Z d d l m Z d d l 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 Z d d l Z d d l Z d d l Z d d l m Z d d l Z d d l m Z d d	 l m Z d d
 l m Z d d l m Z d d l m Z d d l m Z d Z d e j f d     YZ d   Z d   Z d   Z  e j! d e"  d    Z# e j$ d e% f d     Y Z& d e% f d     YZ' d   Z( d   Z) d   Z* d   Z+ d   Z, d S(   st    terminal reporting of the full testing process.

This is a good source for looking at the various reporting hooks.
i    (   t   absolute_import(   t   division(   t   print_functionN(   t   partial(   t   collapse(   t   nodes(   t   EXIT_INTERRUPTED(   t   EXIT_NOTESTSCOLLECTED(   t   EXIT_OK(   t   EXIT_TESTSFAILED(   t   EXIT_USAGEERRORg      ?t   MoreQuietActionc           B` s,   e  Z d  Z d e d d  Z d d  Z RS(   s   
    a modified copy of the argparse count action which counts down and updates
    the legacy quiet attribute at the same time

    used to unify verbosity handling
    c         C` s;   t  t |   j d | d | d d d | d | d |  d  S(   Nt   option_stringst   destt   nargsi    t   defaultt   requiredt   help(   t   superR   t   __init__(   t   selfR   R   R   R   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR   *   s    c         C` sI   t  | |  j d  d } t | |  j |  t  | d d  d | _ d  S(   Ni    i   t   quiet(   t   getattrR   t   setattrR   (   R   t   parsert	   namespacet   valuest   option_stringt	   new_count(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   __call__4   s    N(   t   __name__t
   __module__t   __doc__t   Nonet   FalseR   R   (    (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR   "   s   
c         C` s  |  j  d d d d } | j d d d d d	 d
 d d d d f | j d d d t d	 d
 d d d d f | j d d d d t d	 d
 d d | j d d d d d d	 d d d d d | j d d d	 t d d d d d d  | j d! d" d d d d# d	 t d d$ | j d% d d& d d d d' d	 d( d) d( d* d+ d, d- d. g d d/ | j d0 d d d d1 d) d, d2 d3 d4 d5 g d	 d5 d d6 | j d7 d8 d d d	 t d d9 | j d: d d; d d d d; d	 d( d) d< d, d( g d d= |  j d> d d? d	 d@ d  S(A   Ns   terminal reportingt	   reportingt   aftert   generals   -vs	   --verboset   actiont   countR   i    R   t   verboseR   s   increase verbosity.s   -qs   --quiets   decrease verbosity.s   --verbosityt   types   set verbositys   -rt   storet   reportcharst    t   metavart   charss   show extra test summary info as specified by chars: (f)ailed, (E)rror, (s)kipped, (x)failed, (X)passed, (p)assed, (P)assed with output, (a)ll except passed (p/P), or (A)ll. Warnings are displayed at all times except when --disable-warnings is set.s   --disable-warningss   --disable-pytest-warningst   disable_warningst
   store_trues   disable warnings summarys   -ls   --showlocalst
   showlocalss0   show locals in tracebacks (disabled by default).s   --tbt   stylet   tbstylet   autot   choicest   longt   shortt   not   linet   natives6   traceback print mode (auto/long/short/line/native/no).s   --show-capturet   showcapturet   stdoutt   stderrt   logt   allsS   Controls how captured stdout/stderr/log is shown on failed tests. Default is 'all'.s   --fulltraces   --full-traces-   don't cut any tracebacks (default is to cut).s   --colort   colort   yess$   color terminal output (yes/no/auto).t   console_output_stylesg   console output: "classic", or with additional progress information ("progress" (percentage) | "count").t   progress(   t   getgroupt
   _addoptionR   t   intR"   t   addini(   R   t   group(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_addoption;   s    

c         ` si   t  |  t j    |  j j   d  |  j j s= |  j j re   f d   } |  j j	 j
 d |  n  d  S(   Nt   terminalreporterc         ` s-   d j  t t |   }   j d |  d  S(   Nt    s   [traceconfig] (   t   joint   mapt   strt
   write_line(   t   tagst   argst   msg(   t   reporter(    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   mywriter   s    s   pytest:config(   t   TerminalReportert   sysR<   t   pluginmanagert   registert   optiont   debugt   traceconfigt   tracet   roott   setprocessor(   t   configRT   (    (   RS   s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_configure   s
    c         C` s   d } |  j  j } |  j  j r8 d | k r8 | d 7} n- |  j  j re d | k re | j d d  } n  xR | D]J } | d k r d } ql | d k r d } Pql | | k rl | | 7} ql ql W| S(   NR,   t   wt   at   sxXwEft   At   PpsxXwEf(   RY   R+   R/   t   replace(   R_   t
   reportoptsR+   t   char(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   getreportopt   s    	t   trylastc         C` sg   |  j  r d } n< |  j r$ d } n* |  j rN d } |  j d k rN d } qN n  |  j | |  j j   f S(   Nt   .t   st   Ft   callt   f(   t   passedt   skippedt   failedt   whent   outcomet   upper(   t   reportt   letter(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_report_teststatus   s    					t   WarningReportc           B` sM   e  Z d  Z e j   Z e j d d  Z e j d d  Z e	 Z
 d   Z RS(   sr  
    Simple structure to hold warnings information captured by ``pytest_warning_captured``.

    :ivar str message: user friendly message about the warning
    :ivar str|None nodeid: node id that generated the warning (see ``get_location``).
    :ivar tuple|py.path.local fslocation:
        file system location of the source of the warning (see ``get_location``).
    R   c         C` s   |  j  r |  j  S|  j r t |  j t  r t |  j  d k r |  j d  \ } } t j j |  j | j	  } | s t
 |  } n  d | | f St
 |  j  Sn  d S(   sn   
        Returns the more user-friendly information about the location
        of a warning, or None.
        i   s   %s:%sN(   t   nodeidt
   fslocationt
   isinstancet   tuplet   lent   pyt   patht   localt   reltot   invocation_dirRN   R!   (   R   R_   t   filenamet   linenumt   relpath(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   get_location   s    		'N(   R   R   R    t   attrt   ibt   messageR!   Rz   R{   t   Truet   count_towards_summaryR   (    (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyRy      s   	RU   c           B` sH  e  Z d8 d   Z d   Z e d    Z e d    Z e d    Z e j	 d    Z e d    Z
 d   Z d   Z d	 d
  Z d   Z d   Z d   Z d   Z d8 d  Z d d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z e d    Z d   Z d   Z  e! d  Z" e# j$ d  e%  d!    Z& d"   Z' d#   Z( d$   Z) d%   Z* e# j$ d& e%  d'    Z+ e# j$ d& e%  d(    Z, d)   Z- d*   Z. d+   Z/ d,   Z0 d-   Z1 d.   Z2 d/   Z3 d0   Z4 d1   Z5 d2   Z6 d3   Z7 d4   Z8 d5   Z9 d6   Z: d7   Z; RS(9   c         C` s   d d  l  } | |  _ d |  _ d  |  _ d  |  _ i  |  _ | j |  _ | d  k r] t	 j
 } n  | j j | |  |  _ |  j |  _ |  j j |  _ d  |  _ t |  |  _ |  j j |  _ | j   |  _ t   |  _ |  j   |  _ d  |  _ d  S(   Ni    (   t   _pytest.configR_   t   _numcollectedR!   t   _sessiont   _showfspatht   statsR   t   startdirRV   R<   t   create_terminal_writert   _twt   writert	   fullwidtht   _screen_widtht   currentfspathRi   R+   t	   hasmarkupt   isattyt   sett   _progress_nodeids_reportedt   _determine_show_progress_infot   _show_progress_infot   _collect_report_last_write(   R   R_   t   filet   _pytest(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR      s&    						c         C` s^   |  j  j d d  d k r t S|  j  j d t  r8 t S|  j  j d  } | d k rZ | St S(   sQ   Return True if we should display progress information based on the current configt   captureR8   t	   setupshowRB   RC   R'   (   RC   R'   (   R_   t	   getoptionR"   t   getini(   R   t   cfg(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR      s    c         C` s   |  j  j j S(   N(   R_   RY   R(   (   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt	   verbosity
  s    c         C` s   |  j  d k S(   Ni    (   R   (   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt
   showheader  s    c         C` s#   |  j  d  k r |  j d k S|  j  S(   Ni    (   R   R!   R   (   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt
   showfspath  s    c         C` s   | |  _  d  S(   N(   R   (   R   t   value(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR     s    c         C` s   |  j  d k S(   Ni    (   R   (   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   showlongtestinfo  s    c         C` s-   i d d 6d d 6j  | |  } | |  j k S(   Nt   xt   xfailedRl   Rq   (   t   getR+   (   R   Rh   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   hasopt   s     c         K` s   |  j  j j | j d  d  } |  j d  k s@ | |  j k r |  j d  k	 re |  j re |  j   n  | |  _ |  j j	 |  } |  j
 j   |  j
 j | d  n  |  j
 j | |  d  S(   Ns   ::i    RK   (   R_   t   rootdirRL   t   splitR   R!   R   t)   _write_progress_information_filling_spaceR   t   bestrelpathR   R9   t   write(   R   Rz   t   rest   markupt   fspath(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   write_fspath_result$  s    "	R,   c         K` sa   |  j  | k r8 |  j j   | |  _  |  j j |  n  | r] |  j j | |  d |  _  n  d  S(   Ni(   R   R   R9   R   (   R   t   prefixt   extrat   kwargs(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   write_ensure_prefix1  s    	c         C` s&   |  j  r" |  j j   d  |  _  n  d  S(   N(   R   R   R9   R!   (   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   ensure_newline:  s    	c         K` s   |  j  j | |  d  S(   N(   R   R   (   R   t   contentR   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR   ?  s    c         K` sK   t  | t j  s* t j | d d } n  |  j   |  j j | |  d  S(   Nt   errorsRf   (   R|   t   sixt	   text_typeR   R   R9   (   R   R9   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyRO   B  s    
c         K` sp   | j  d t  } | r? |  j j t |  d } d | } n d } t |  } |  j j d | | |  d S(   s*  
        Rewinds the terminal cursor to the beginning and writes the given line.

        :kwarg erase: if True, will also add spaces until the full terminal width to ensure
            previous lines are properly erased.

        The rest of the keyword arguments are markup instructions.
        t   erasei   RK   R,   s   N(   t   popR"   R   R   R~   RN   R   (   R   R9   R   R   t
   fill_countt   fill(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   rewriteH  s    	c         K` s$   |  j    |  j j | | |  d  S(   N(   R   R   t   sep(   R   R   t   titleR   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt	   write_sepZ  s    
t   =c         K` s   |  j  j | | |  d  S(   N(   R   R   (   R   R   R   t   kw(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   section^  s    c         K` s   |  j  j | |  d  S(   N(   R   R9   (   R   RR   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR9   a  s    c         C` s8   x1 t  j |  j d  D] } |  j d |  q Wd S(   Ns   
s   INTERNALERROR> i   (   R   R   R   RO   (   R   t   excreprR9   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_internalerrord  s    c   	      C` s   d d l  m } |  j j d g   } | j | j f } | |  } | d  k	 rX | j n d } t d | d | d |  } | j	 |  d  S(   Ni    (   t   warning_record_to_strt   warningsR,   R{   R   Rz   (
   t   _pytest.warningsR   R   t
   setdefaultR   t   linenoR!   Rz   Ry   t   append(	   R   t   warning_messaget   itemR   R   R{   R   Rz   t   warning_report(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_warning_capturedi  s    c         C` s0   |  j  j j r, d | f } |  j |  n  d  S(   Ns   PLUGIN registered: %s(   R_   RY   R[   RO   (   R   t   pluginRR   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_plugin_registeredw  s    c         C` s    |  j  j d g   j |  d  S(   Nt
   deselected(   R   R   t   extend(   R   t   items(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_deselected  s    c         C` sa   |  j  r. |  j | |  } |  j | d  n/ |  j r] | j d  d } |  j | d  n  d  S(   NR,   s   ::i    (   R   t   _locationlineR   R   R   R   (   R   Rz   t   locationR9   t   fsid(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_runtest_logstart  s    		c         C` sw  t  |  _ | } |  j j j d | d |  j  } | \ } } } t | t  r] | \ } } n d  } |  j j	 | g   j
 |  | r | r d  St | d  } | d  k r5t | d  }	 | j r |	 r i t  d 6} q5| j r |	 r i t  d 6} q5| j ri t  d 6} q5| j r,i t  d 6} q5i  } n  |  j d k r| rm|  j rm|  j | j | |  qs|  j j | |  n |  j j | j  |  j | j | j  }
 | s|  j |
 | |  |  j rs|  j   qsn |  j   |  j j d	 | j j j  |  j r3|  j j |  j    d
 d t  n |  j j d
  |  j j | |  |  j j d
 |
  d |  _! d  S(   NRv   R_   t   nodet   wasxfailt   greent   yellowt   redi    s   [%s]RK   t   cyani("   R   t
   _tests_ranR_   t   hookRx   R|   R}   R!   R   R   R   t   hasattrRp   Rr   Rq   R   R   R   Rz   R   R   R   t   addR   R   R   R   R   R   R   t   gatewayt   idt!   _get_progress_information_messageR   (   R   Rv   t   repR   t   categoryRw   t   wordR   t   running_xdistt	   was_xfailR9   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_runtest_logreport  sR    	!				
		c         C` s   |  j  d k r |  j r |  j d k rZ |  j j } t d j t |  t |    } n t d  } |  j j |  t |  j  |  j j k } | r |  j	   q |  j
 } | | d |  j k } | r |  j   } |  j j | d d t q n  d  S(   Ni    R'   s    [{}/{}]s    [100%]i   s   
R   (   R   R   R   t   testscollectedR~   t   formatRN   R   R   R   t   _width_of_current_lineR   R   R   R   R   (   R   Rz   t	   num_testst   progress_lengtht   is_last_itemRa   t	   past_edgeRR   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_runtest_logfinish  s    '	c         C` s   |  j  j } |  j d k rz | rj |  j } d j t t |    } d j |  } | j t |  |  Sd j | |  S| r t |  j  d | } d j |  Sd Sd  S(   NR'   s   {{:{}d}}s
    [{}/{{}}]s    [ {} / {} ]id   s	    [{:3d}%]s    [100%](   R   R   R   R   R   R~   RN   (   R   t	   collectedRC   t   counter_formatt   format_string(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR     s    	c         C` sI   |  j    } |  j } |  j j | d } |  j | j |  d t d  S(   Ni   R   (   R   R   R   R   R   t   rjustR   (   R   RR   Ra   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR     s    	c         C` s-   y |  j  j SWn t k
 r( |  j  j SXd S(   s\   Return the width of current line, using the superior implementation of py-1.6 when availableN(   R   t   width_of_current_linet   AttributeErrort   chars_on_current_line(   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR     s    c         C` su   |  j  rF |  j j j d k rq |  j d d t t j   |  _ qq n+ |  j j j d k rq |  j d d t n  d  S(   Ni    s   collecting ... t   boldi   (   R   R_   RY   R(   R   R   t   timeR   (   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_collection  s    	c         C` s   | j  r( |  j j d g   j |  n( | j rP |  j j d g   j |  n  g  | j D] } t | t j  rZ | ^ qZ } |  j	 t
 |  7_	 |  j r |  j   n  d  S(   Nt   errorRq   (   Rr   R   R   R   Rq   t   resultR|   t   pytestt   ItemR   R~   R   t   report_collect(   R   Rv   R   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_collectreport  s    		.	c         C` s  |  j  j j d k  r d  S| s] t j   } |  j d  k	 rQ |  j | t k rQ d  S| |  _ n  t |  j j	 d g    } t |  j j	 d g    } t |  j j	 d g    } |  j
 | | | } | r d } n d } | t |  j
  d |  j
 d k r d	 n d
 7} | r| d | 7} n  | r6| d | 7} n  | rM| d | 7} n  |  j
 | k ogd k n r}| d | 7} n  |  j r|  j | d t d t | r|  j d  qn |  j |  d  S(   Ni    R  Rq   R   s
   collected s   collecting s    itemi   R,   Rl   s    / %d errorss    / %d deselecteds    / %d skippeds    / %d selectedR  R   s   
(   R_   RY   R(   R  R   R!   t   REPORT_COLLECTING_RESOLUTIONR~   R   R   R   RN   R   R   R   R   RO   (   R   t   finalt   tR   Rq   R   t   selectedR9   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR    s<    	-	Rj   c         C` sX  | |  _  t j   |  _ |  j s% d  S|  j d d d t t j   } d t j | f } t	 t d  r d j
 t t t j d    } | d | t j d f 7} n  | d	 t j t j t j f 7} |  j d
 k s |  j j j s t |  j j d d   r| d t t j  7} n  |  j |  |  j j j d |  j d |  j  } |  j |  d  S(   NR   s   test session startsR  s   platform %s -- Python %st   pypy_version_infoRk   i   s   [pypy-%s-%s]s   , pytest-%s, py-%s, pluggy-%si    t   pastebins    -- R_   R   (   R   R  t   _sessionstarttimeR   R   R   t   platformt   python_versionRV   R   RL   RM   RN   R  R
  t   __version__R   t   pluggyR   R_   RY   RZ   R   R!   t
   executableRO   R   t   pytest_report_headerR   t   _write_report_lines_from_hooks(   R   t   sessiont   verinfoRR   t   lines(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_sessionstart,  s,    		c         C` s2   | j    x! t |  D] } |  j |  q Wd  S(   N(   t   reverseR   RO   (   R   R  R9   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR  I  s    
c         C` s   d | j  } | j r6 | d | j  j | j  7} n  | j d  } | r | j | k r g  | D] } | j  j |  ^ qa } | d j d j |   7} n  | g } | j j   } | r | j	 d d j t
 |    n  | S(   Ns   rootdir: %ss   , inifile: t	   testpathss   , testpaths: {}s   , s   plugins: %s(   R   t   inifileR   R   RQ   R   RL   RW   t   list_plugin_distinfoR   t   _plugin_nameversions(   R   R_   R9   R!  R   t	   rel_pathsR	  t
   plugininfo(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR  N  s    	 %	#c         C` s   |  j  t  |  j j d  r2 |  j | j  n  |  j j j d |  j d |  j d | j  } |  j	 |  |  j j d  r |  j
 j d  r |  j j d d  x- |  j
 j d  D] } | j |  j  q Wq n  d  S(   Nt   collectonlyR_   R   R   Rr   t   !s   collection failures(   R  R   R_   R   t   _printcollecteditemsR   R   t   pytest_report_collectionfinishR   R  R   R   R   R   t
   toterminal(   R   R  R  R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_collection_finish_  s    c         C` s&  |  j  j j d k  r |  j  j j d k  r i  } xA | D]9 } | j j d d  d } | j | d  d | | <q7 Wxa t | j    D]& \ } } |  j j	 d | | f  q Wn$ x! | D] } |  j j	 | j  q Wd  Sg  } d } x7| D]/} | j
   d } x. | r5| | t |   k r(Pn  | j   qWx | t |  D] }	 | j |	  |	 j d k roqGn  t |  d d } |  j j	 d	 | |	 f  |  j  j j d k rGt |	 d
  r|	 j j rxG |	 j j j   j   D]* }
 |  j j	 d	 | d |
 j   f  qWqqGqGWq Wd  S(   Ni    is   ::i   s   %s: %dR,   s   ()s     s   %s%st   _obj(   R_   RY   R(   Rz   R   R   t   sortedR   R   R9   t	   listchainR~   R   R   t   nameR   R-  R    t   stript
   splitlines(   R   R   t   countsR   R0  R'   t   stackt   indentt   needed_collectorst   colR9   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR)  p  s:    !	t   hookwrapperc         c` s   d  V} | j    |  j j d  t t t t t f } | | k rj |  j j	 j
 d |  d | d |  j  n  | t k r |  j   |  ` n  |  j   d  S(   NR,   RJ   t
   exitstatusR_   (   t
   get_resultR   R9   R   R	   R   R
   R   R_   R   t   pytest_terminal_summaryt   _report_keyboardinterruptt   _keyboardinterrupt_memot   summary_stats(   R   R9  Rt   t   summary_exit_codes(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_sessionfinish  s    
	
	c         c` sE   |  j    |  j   |  j   |  j   d  V|  j   |  j   d  S(   N(   t   summary_errorst   summary_failurest   summary_warningst   summary_passest   short_test_summary(   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR;    s    




c         C` s   | j  d t  |  _ d  S(   Nt   funcargs(   t   getreprR   R=  (   R   t   excinfo(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_keyboard_interrupt  s    c         C` s    t  |  d  r |  j   n  d  S(   NR=  (   R   R<  (   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   pytest_unconfigure  s    c         C` s   |  j  } | j j } |  j d |  d | k r |  j j j rS | j |  j  q | j j |  j  |  j j	 d d t
 n  d  S(   NR(  t   KeyboardInterrupts?   (to show a full traceback on KeyboardInterrupt use --fulltrace)R   (   R=  t	   reprcrashR   R   R_   RY   t	   fulltraceR+  R   R9   R   (   R   R   RR   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR<    s    		c         ` s      f d   } | r{ | |  }  j  d k r | j d  d | j d t j  k r | d  j j |  7} q n d } | d S(	   Nc         ` s{    j  j |   }   rw | j    rw | t     }   j d  } | d j d d  | d <| d j |  7} n  | S(   Nt   [i    Rk   s   ::(   R_   t   cwd_relative_nodeidt   endswithR~   R   Rf   RL   (   Rz   R9   R   (   t   domainR   (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   mkrel  s    i   s   ::i    s   \s    <- s
   [location]RK   (   R   R   Rf   R   t   SEPR   R   (   R   Rz   R   R   RQ  RR  R   (    (   RQ  R   s/   lib/python2.7/site-packages/_pytest/terminal.pyR     s    % c         C` s   | j  } | r | Sd S(   Ns   test session(   t	   head_line(   R   R   RT  (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   _getfailureheadline  s    	c         C` sV   y t  | j j  SWn; t k
 rQ y t  | j  d  SWqR t k
 rM d SXn Xd  S(   Ni2   R,   (   RN   t   longreprRL  R  (   R   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   _getcrashline  s    c         C` sI   g  } x< |  j  j | g   D]% } t | d  s | j |  q q W| S(   Nt	   _pdbshown(   R   R   R   R   (   R   R0  R   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt
   getreports  s
    c         C` s  |  j  d  r|  j j d  } | s+ d  St |  d  } | rP | |  j } n | } t |  |  _ | so d  St j   } x* | D]" } | j | j	 g   j
 |  q W| r d n d } |  j d | d t d t x | j   D] \ } } t } xE | D]= }	 |	 j |  j  }
 |
 r |  j j t |
   t } q q W| rw| j   } d	 j d
   | D  } | j   } n | j   } |  j j |  |  j j   q W|  j j d  n  d  S(   NRa   R   t   _already_displayed_warningss   warnings summary (final)s   warnings summaryR   R   R  s   
c         s` s   |  ] } d  | Vq d S(   s     N(    (   t   .0R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pys	   <genexpr>  s    s8   -- Docs: https://docs.pytest.org/en/latest/warnings.html(   R   R   R   R   RZ  R~   t   collectionst   OrderedDictR   R   R   R   R   R"   R   R   R_   R   R9   RN   R2  RL   t   rstrip(   R   t   all_warningsR  t   warning_reportst   reports_grouped_by_messaget   wrR   R   t   has_any_locationRa   R   R  t   indented(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyRC    s>     c         C` s   |  j  j j d k r |  j d  r |  j d  } | s= d  S|  j d d  xU | D]J } | j rT |  j |  } |  j d | d t d t |  j	 |  qT qT Wq n  d  S(	   NR8   t   PRp   R   t   PASSESt   _R   R  (
   R_   RY   R3   R   RY  R   t   sectionsRU  R   t   _outrep_summary(   R   t   reportsR   RR   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyRD    s    	c         C` s   |  j  j j } | d k r d  Sx | j D]y \ } } | d k rS | | k rS q) n  d | k r) |  j j d |  | d d k r | d  } n  |  j j |  q) q) Wd  S(   NR8   R?   t   teardownt   -is   
(   R_   RY   R;   Rh  R   R   R9   (   R   R   R;   t   secnameR   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   print_teardown_sections*  s    c         C` sN  |  j  j j d k rJ|  j d  } | s. d  S|  j d d  |  j  j j d k r x | D]" } |  j |  } |  j |  qZ WqJi  } xE |  j d  D]4 } | j d k r | j | j	 g   j
 |  q q Wxv | D]k } |  j |  } |  j d | d	 t d
 t |  j |  x* | j | j	 g   D] } |  j |  q,Wq Wn  d  S(   NR8   Rr   R   t   FAILURESR9   R,   Rk  Rg  R   R  (   R_   RY   R3   RY  R   RW  RO   Rs   R   Rz   R   RU  R   Ri  R   Rn  (   R   Rj  R   R9   t   teardown_sectionsRv   RR   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyRB  7  s&    #c         C` s   |  j  j j d k r |  j d  } | s. d  S|  j d d  x |  j d D]m } |  j |  } | j d k r} d | } n d | j | f } |  j d | d	 t d
 t |  j	 |  qL Wn  d  S(   NR8   R  R   t   ERRORSt   collects   ERROR collecting s   ERROR at %s of %sRg  R   R  (
   R_   RY   R3   RY  R   R   RU  Rs   R   Ri  (   R   Rj  R   RR   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyRA  N  s    c         C` s   | j  |  j  |  j j j } | d k r/ d  Sxu | j D]j \ } } | d k rc | | k rc q9 n  |  j j d |  | d d k r | d  } n  |  j j |  q9 Wd  S(   NR8   R?   Rl  is   
(   R+  R   R_   RY   R;   Rh  R   R9   (   R   R   R;   Rm  R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyRi  ]  s    c         C` s   t  j    |  j } t |  j  \ } } d | | f } i t | 6t d 6} |  j d k rq |  j d | |  n  |  j d k r |  j | |  n  d  S(   Ns   %s in %.2f secondsR  i    R   i(   R  R  t   build_summary_stats_lineR   R   R   R   RO   (   R   t   session_durationR9   R@   RR   R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR>  j  s    c   
      ` s"    j  s d  S  f d   }   f d   }   f d   }   f d   } i | d 6| d 6t | d  d 6t | d  d	 6| d
 6| d 6t | d  d 6t | d  d 6} g  } x3   j  D]( } | j |  } | r | |  q q W| r  j d d  x | D] }	   j |	  qWn  d  S(   Nc         ` sh     j  j |  g   } | s d  S  j j }   j } x- | D]% } t | | |  } | j |  q; Wd  S(   N(   R   R   R   R   R_   t    _get_line_with_reprcrash_messageR   (   t   statR  Rr   t	   termwidthR_   R   R9   (   R   (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   show_simpley  s    	c         ` s     j  j d g   } xr | D]j } | j   j  } t   j |  } |  j d | | f  | j } | r |  j d t |   q q Wd  S(   NR   s   %s %ss     (   R   R   t   _get_verbose_wordR_   t   _get_posR   R   RN   (   R  R   R   t   verbose_wordt   post   reason(   R   (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   show_xfailed  s    	c         ` sq     j  j d g   } xU | D]M } | j   j  } t   j |  } | j } |  j d | | | f  q Wd  S(   Nt   xpasseds   %s %s %s(   R   R   Ry  R_   Rz  R   R   (   R  R  R   R{  R|  R}  (   R   (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   show_xpassed  s    	c         ` s     j  j d g   } | r' t |  n g  } | s7 d  S| d j   j  } x | D]~ \ } } } } | j d  r | d } n  | d  k	 r |  j d | | | | d | f  qT |  j d | | | | f  qT Wd  S(   NRq   i    s	   Skipped: i	   s   %s [%d] %s:%d: %si   s   %s [%d] %s: %s(   R   R   t   _folded_skipsRy  R_   t
   startswithR!   R   (   R  Rq   t   fskipsR{  t   numR   R   R}  (   R   (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   show_skipped  s    R   t   XRr   Ro   Rm   Rl   t   SRp   t   pR  t   ER   s   short test summary info(   R+   R   R   R   RO   (
   R   Rx  R~  R  R  t   REPORTCHAR_ACTIONSR  Rh   R&   R9   (    (   R   s/   lib/python2.7/site-packages/_pytest/terminal.pyRE  u  s0    	

N(<   R   R   R!   R   R   t   propertyR   R   R   t   setterR   R   R   R   R   R   RO   R   R   R   R9   R   R   R   R   R   R   R   R   R   R   R  R  R"   R  R
  t   hookimplR   R  R  R  R,  R)  R@  R;  RI  RJ  R<  R   RU  RW  RY  RC  RD  Rn  RB  RA  Ri  R>  RE  (    (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyRU      sh   														
	3						
(				#								&						c         C` s   |  j  | j  } | S(   N(   RO  Rz   (   R_   R   Rz   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyRz    s    c         C` s  d d l  m } | j |   } t |  |  } d | | f } | |  } d
 \ } }	 | | |	 k rj | Sy | j j j }
 Wn t k
 r n X|
 j d  } | d k r |
 |  }
 n  | |
  } d \ } } | | | } | |	 k r| | k r}| |	 8} |
 |  }
 x  | |
  | k r-|
 d  }
 qWt	 j
 rpy" t	 j d	  } |
 j |  }
 Wqpt k
 rlqpXn  |
 | 7}
 n  | | |
 7} n  | S(   s?   Get summary line for a report, trying to add reprcrash message.i    (   t   wcswidths   %s %ss   ...i   s   
is    - i=  (   s   ...i   (   s    - i   (   t   wcwidthR  Ry  Rz  RV  RL  R   R  t   findR   t   PY2t   unichrR^  t
   ValueError(   R_   R   Rw  R  R{  R|  R9   t   len_linet   ellipsist   len_ellipsisRR   t   it   len_msgR   t   len_sept   max_len_msgt	   surrogate(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyRu    sB    

	c         C` s   i  } x |  D] } | j  } t |  d k s@ t | | f   t | d i   } | j d k r d | k r d | k r | d d  | d f } n  | j | g   j |  q Wg  } x4 | j   D]& \ } } | j t |  f |  q W| S(   Ni   t   keywordst   setupt   skipt
   pytestmarki    i   (	   RV  R~   t   AssertionErrorR   Rs   R!   R   R   R   (   Rq   t   dt   eventt   keyR  R   t   events(    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR    s    	$c   
      C` s,  d j    } t } x9 |  D]1 } | | k r | rJ | j |  t } qJ q q Wg  } xV | D]N } |  j | d   } | r[ t d   | D  } | j d | | f  q[ q[ W| r d j |  } n d } d |  k s d |  k r d }	 n6 d	 |  k s | rd
 }	 n d |  k rd }	 n d
 }	 | |	 f S(   Ns?   failed passed skipped deselected xfailed xpassed warnings errorc         s` s'   |  ] } t  | d  t  r d Vq d S(   R   i   N(   R   R   (   R[  R   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pys	   <genexpr>  s    s   %d %ss   , s   no tests ranRr   R  R   R   R   Rp   R   (   R   R"   R   R   R   R!   t   sumRL   (
   R   t   known_typest   unknown_type_seent
   found_typet   partsR  Rj  R'   R9   R@   (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyRs    s2    			c         C` sk   g  } x^ |  D]V \ } } d j  d |  } | j d  rG | d } n  | | k r | j |  q q W| S(   Ns"   {dist.project_name}-{dist.version}t   dists   pytest-i   (   R   R  R   (   R&  R   R   R  R0  (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyR$  1  s    (-   R    t
   __future__R    R   R   t   argparseR\  R  RV   R  t	   functoolsR   R   R  R   R   t   more_itertoolsR   R
  R   R   t   _pytest.mainR   R   R   R	   R
   R  t   ActionR   RI   R`   Ri   R  R   Rx   Rl   t   objectRy   RU   Rz  Ru  R  Rs  R$  (    (    (    s/   lib/python2.7/site-packages/_pytest/terminal.pyt   <module>   sJ   	[			"  		5		$