σ
η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 m Z d d l	 Z	 d d l
 Z
 d d l m Z d e f d	     YZ d
   Z e
 j d e  d    Z d   Z d   Z d   Z d g Z d   Z d   Z d S(   s6    version info, help messages, tracing configuration.  i    (   t   absolute_import(   t   division(   t   print_functionN(   t   Action(   t	   PrintHelpt
   HelpActionc           B` s,   e  Z d  Z d e d d  Z d d  Z RS(   s  This is an argparse Action that will raise an exception in
    order to skip the rest of the argument parsing when --help is passed.
    This prevents argparse from quitting due to missing required arguments
    when any are defined, for example by ``pytest_addoption``.
    This is similar to the way that the builtin argparse --help option is
    implemented by raising SystemExit.
    c         C` s;   t  t |   j d | d | d t d | d d d |  d  S(   Nt   option_stringst   destt   constt   defaultt   nargsi    t   help(   t   superR   t   __init__t   True(   t   selfR   R   R	   R   (    (    s1   lib/python2.7/site-packages/_pytest/helpconfig.pyR      s    c         C` s8   t  | |  j |  j  t | j d t  r4 t  n  d  S(   Nt   after_preparse(   t   setattrR   R   t   getattrt   _parsert   FalseR   (   R   t   parsert	   namespacet   valuest   option_string(    (    s1   lib/python2.7/site-packages/_pytest/helpconfig.pyt   __call__$   s    N(   t   __name__t
   __module__t   __doc__t   NoneR   R   R   (    (    (    s1   lib/python2.7/site-packages/_pytest/helpconfig.pyR      s   
c         C` sε   |  j  d  } | j d d d d d | j d d d t d	 d d d
 | j d d d d	 d d g  d d d d | j d d d d d t d d f | j d d d d	 d d t d d | j d d d	 d d d d d d  S(   Nt   debugconfigs	   --versiont   actiont
   store_trueR   s2   display pytest lib version and import information.s   -hs   --helpR   s(   show help message and configuration infos   -pt   appendt   pluginsR	   t   metavart   names   early-load given plugin module name or entry point (multi-allowed). To avoid loading of plugins, use the `no:` prefix, e.g. `no:doctest`.s   --traceconfigs   --trace-configs*   trace considerations of conftest.py files.s   --debugt   debugs>   store internal tracing debug information in 'pytestdebug.log'.s   -os   --override-init   override_inis^   override ini option with "option=value" style, e.g. `-o xfail_strict=True -o cache_dir=cache`.(   t   getgroupt	   addoptiont
   _addoptionR   R   (   R   t   group(    (    s1   lib/python2.7/site-packages/_pytest/helpconfig.pyt   pytest_addoption,   sH    
t   hookwrapperc          #` sζ   d  V}  |  j        j j rβ t j j d  } t | d    j d t j	 t
 j	 d j t t t j   t j     j f    j j j  j    j j    t j j d |      f d   }   j |  n  d  S(   Ns   pytestdebug.logt   ws5   versions pytest-%s, py-%s, python-%s
cwd=%s
args=%s

t   .s&   writing pytestdebug information to %s
c           ` s?    j    t j j d  j    j j j d      d  S(   Ns$   wrote pytestdebug information to %s
(	   t   closet   syst   stderrt   writeR$   t   tracet   roott	   setwriterR   (    (   t   configt	   debugfilet   undo_tracing(    s1   lib/python2.7/site-packages/_pytest/helpconfig.pyt   unset_tracingq   s    
(   t
   get_resultt   optionR%   t   ost   patht   abspatht   openR2   t   pytestt   __version__t   pyt   joint   mapt   strR0   t   version_infot   getcwdt	   _origargsR3   R4   R5   t   pluginmanagert   enable_tracingR1   t   add_cleanup(   t   outcomeR=   R9   (    (   R6   R7   R8   s1   lib/python2.7/site-packages/_pytest/helpconfig.pyt   pytest_cmdline_parse[   s"    	c         C` sp   t  j j t j  } t j j d t j | f  t	 |   } | rl x% | D] } t j j | d  qK Wn  d  S(   Ns,   This is pytest version %s, imported from %s
s   
(
   RB   R=   t   localR@   t   __file__R0   R1   R2   RA   t   getpluginversioninfo(   R6   t   pt
   plugininfot   line(    (    s1   lib/python2.7/site-packages/_pytest/helpconfig.pyt   showversionz   s    	c         C` sL   |  j  j r t |   d S|  j  j rH |  j   t |   |  j   d Sd  S(   Ni    (   R;   t   versionRT   R   t   _do_configuret   showhelpt   _ensure_unconfigure(   R6   (    (    s1   lib/python2.7/site-packages/_pytest/helpconfig.pyt   pytest_cmdline_main   s    



c      
   C` s  d d  l  } |  j j d  } | j } | j |  j j j    | j   | j d  | j   | j	 } d } d | } x:|  j j
 D],} |  j j | \ } }	 }
 |	 d  k r» d }	 n  d | |	 f } | j d |  t |  } | | d	 k rG| j   | j | | d
 | d | d t } x | D] } | j |  q-Wq | j d | | d  | j | | | d t } | j | d  x# | d D] } | j | |  qWq W| j   | j d  d d  d! d" g } x+ | D]# \ } } | j d | | f  qηW| j   | j   | j d  | j d  | j d  x7 | j j d g   D]  } | j d | j d t q_Wd  S(#   Ni    t   terminalreportersJ   [pytest] ini-options in the first pytest.ini|tox.ini|setup.cfg file found:i   t    t   strings   %s (%s):s     %si   t   initial_indentt   subsequent_indentt   break_on_hyphensi   i   s   environment variables:t   PYTEST_ADDOPTSs   extra command line optionst   PYTEST_PLUGINSs.   comma-separated plugins to load during startupt   PYTEST_DISABLE_PLUGIN_AUTOLOADs"   set to disable plugin auto-loadingt   PYTEST_DEBUGs1   set to enable debug tracing of pytest's internalss
     %-24s %ss/   to see available markers type: pytest --markerss1   to see available fixtures type: pytest --fixturess   (shown according to specified file_or_dir or current dir if not specified; fixtures with leading '_' are only shown with the '-v' optiont   warningss
   warning : t   red(   R`   s   extra command line options(   Ra   s.   comma-separated plugins to load during startup(   Rb   s"   set to disable plugin auto-loading(   Rc   s1   set to enable debug tracing of pytest's internals(   t   textwrapRI   t
   get_plugint   _twR2   R   t	   optparsert   format_helpRS   t	   fullwidtht	   _ininamest   _inidictR   t   lent   wrapR   t   statst   gett   messageR   (   R6   Rf   t   reportert   twt   columnst
   indent_lent   indentR$   R   t   typeR	   t   spect   spec_lent	   helplinesRS   t   wrappedt   varst   warningreport(    (    s1   lib/python2.7/site-packages/_pytest/helpconfig.pyRW      sd    	

	
	
	
	

t   pytest_pluginss   list of plugin names to loadc         C` s   g  } |  j  j   } | r | j d  xY | D]N \ } } t | d t |   } d | j | j | f } | j d |  q/ Wn  | S(   Ns   setuptools registered plugins:RO   s   %s-%s at %ss     (   RI   t   list_plugin_distinfoR!   R   t   reprt   project_nameRU   (   R6   t   linesRR   t   plugint   distt   loct   content(    (    s1   lib/python2.7/site-packages/_pytest/helpconfig.pyRP   Ω   s    c         C` sδ   g  } |  j  j s |  j  j r` | j d t j t j f  t |   } | r` | j |  q` n  |  j  j rΰ | j d  |  j	 j
   } xU | D]J \ } } t | d  rΆ | j } n t |  } | j d | | f  q Wn  | S(   Ns   using: pytest-%s pylib-%ss   active plugins:RO   s       %-20s: %s(   R;   R%   t   traceconfigR!   R@   RA   RB   RP   t   extendRI   t   list_name_plugint   hasattrRO   R   (   R6   R   t   verinfot   itemsR$   R   t   r(    (    s1   lib/python2.7/site-packages/_pytest/helpconfig.pyt   pytest_report_headerε   s    (   R   s   list of plugin names to load(   R   t
   __future__R    R   R   R<   R0   t   argparseR   RB   R@   t   _pytest.configR   R   R+   t   hookimplR   RM   RT   RY   RW   t   conftest_optionsRP   R   (    (    (    s1   lib/python2.7/site-packages/_pytest/helpconfig.pyt   <module>   s$   	/			F		