
^Yc           @` sW  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	 Z d d l
 Z
 y d d l m Z Wn! e k
 r d d l m Z n Xd d l m Z m Z m Z d d l m Z m Z e
 j j e j  j   Z d Z d Z d	 Z d
 Z  d Z! d Z" d   Z# d   Z$ d   Z% d   Z& d   Z' d   Z( d   Z) d   Z* d   Z+ d d, d     YZ, d e- f d     YZ. d e f d     YZ/ d e- f d     YZ0 d e0 f d     YZ1 d  e1 f d!     YZ2 d" e2 f d#     YZ3 d$ e0 f d%     YZ4 d& e5 f d'     YZ6 d( e7 f d)     YZ8 d* e2 f d+     YZ9 d S(-   sF    core implementation of testing process: init, session, runtest loop. i    (   t   absolute_importt   divisiont   print_functionN(   t   MutableMapping(   t	   DictMixin(   t   directory_argt
   UsageErrort   hookimpl(   t   collect_one_nodet   exiti   i   i   i   i   c         C` sL  |  j  d d d d d d d d d	 d
 d d d g |  j  d d d d d g  |  j d d  } | j d d d d d d d d d d f | j d d d d d d t d d d d  d d! | j d" d d# d d$ | j d% d d& d t d d' d d( | j d) d d# d t d d* d d+ |  j d, d-  } | j d. d/ d d# d d0 f | j d1 d d# d d2 | j d3 d d4 d d5 d d6 | j d7 d d8 d d  d d9 d t j	 t
 d: d7 d d; | j d< d d# d d= d t d d> | j d? d@ d d# d dA d t d dB |  j dC dD  } | j dE d dF d d  d d9 d dG d  S(H   Nt   norecursedirss)   directory patterns to avoid for recursiont   typet   argst   defaults   .*t   buildt   distt   CVSt   _darcss   {arch}s   *.eggt   venvt	   testpathss[   directories to search for tests when no files or directories are given in the command line.t   generals   running and selection optionss   -xs   --exitfirstt   actiont   store_constt   destt   maxfailt   consti   t   helps-   exit instantly on first error or failed test.s	   --maxfailt   metavart   numt   storei    s(   exit after first num failures or errors.s   --strictt
   store_trues2   run pytest in strict mode, warnings become errors.s   -ct   filet   inifilenamesc   load configuration from `file` instead of trying to locate one of the implicit configuration files.s   --continue-on-collection-errorst   continue_on_collection_errorss5   Force test execution even if collection errors occur.t   collectt
   collections   --collectonlys   --collect-onlys'   only collect tests, don't execute them.s   --pyargss2   try to interpret all arguments as python packages.s   --ignoret   appendt   paths.   ignore path during collection (multi-allowed).s   --confcutdirt
   confcutdirt   dirt   optnames2   only load conftest.py's relative to specified dir.s   --noconftestt
   noconftests!   Don't load any conftest.py files.s   --keepduplicatess   --keep-duplicatest   keepduplicatess   Keep duplicate tests.t   debugconfigs(   test session debugging and configurations
   --basetempt   basetemps+   base temporary directory for this test run.(   t   addinit   getgroupt
   _addoptiont   intt   strt   Falset	   addoptiont   Nonet	   functoolst   partialR   (   t   parsert   group(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   pytest_addoption   sL    %

		c           C` s   i  S(   s   keeping this one works around a deeper startup issue in pytest

    i tried to find it for a while but the amount of time turned unsustainable,
    so i put a hack in to revisit later
    (    (    (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   pytest_namespaceQ   s    c         C` s   |  t  d  _ d  S(   Nt   pytest(   t
   __import__t   config(   R=   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   pytest_configureZ   s    c         C` s  t  |   } t | _ d } z7yE |  j   d } |  j j d |  d } | |  |  p\ d | _ Wn t k
 ry   n t k
 r t j	 j
   } | d k  r t | j t j  r t j j d j | j | j j   n  |  j j d |  t | _ nT t j	 j
   } |  j | |  j  t | _ | j t  rQt j j d  qQn XWd d } | j j   | d k r|  j j d | d	 | j  n  |  j    X| j S(
   s   Skeleton command line programi    i   t   sessioni   s	   {0}: {1}
t   excinfos&   mainloop: caught Spurious SystemExit!
Nt
   exitstatus(!   t   Sessiont   EXIT_OKRA   t   _do_configuret   hookt   pytest_sessionstartR   t   KeyboardInterruptt   _pytestt   _codet   ExceptionInfot
   isinstancet   valueR	   t	   Exceptiont   syst   stderrt   writet   formatt   typenamet   msgt   pytest_keyboard_interruptt   EXIT_INTERRUPTEDt   notify_exceptiont   optiont   EXIT_INTERNALERRORt   errisinstancet
   SystemExitR4   t   startdirt   chdirt   pytest_sessionfinisht   _ensure_unconfigure(   R=   t   doitR?   t	   initstateR@   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   wrap_session^   sB    	
!	c         C` s   t  |  t  S(   N(   Ra   t   _main(   R=   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   pytest_cmdline_main   s    c         C` sJ   |  j  j d |  |  j  j d |  | j r3 t S| j d k rF t Sd S(   s]    default command line protocol for initialization, session,
    running tests and reporting. R?   i    N(   RE   t   pytest_collectiont   pytest_runtestloopt   testsfailedt   EXIT_TESTSFAILEDt   testscollectedt   EXIT_NOTESTSCOLLECTED(   R=   R?   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyRb      s    	c         C` s
   |  j    S(   N(   t   perform_collect(   R?   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyRd      s    c         C` s   |  j  r2 |  j j j r2 |  j d |  j    n  |  j j j rE t Sx t |  j  D]v \ } } | d t	 |  j  k  r |  j | d n d  } | j j j d | d |  |  j rU |  j |  j   qU qU Wt S(   Ns   %d errors during collectioni   t   itemt   nextitem(   Rf   R=   RW   R!   t   Interruptedt   collectonlyt   Truet	   enumeratet   itemst   lenR4   RE   t   pytest_runtest_protocolt
   shouldstop(   R?   t   iRk   Rl   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyRe      s    	0	c         C` s   | j  d d |  j   } | p$ g  } | j d  } | rk | j g  | D] } t j j |  ^ qI  n  t j j |   | k r t S| j d  } | j j	 } | s |  | k r t S| j
 |   n  t S(   Nt   collect_ignoreR%   t   ignoreR*   (   t   _getconftest_pathlistt   dirpatht	   getoptiont   extendt   pyR%   t   localRo   t   pluginmanagert   _duplicatepathst   addR2   (   R%   R=   t   ignore_pathst
   excludeoptt   xR*   t   duplicate_paths(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   pytest_ignore_collect   s    /t   FSHookProxyc           B` s   e  Z d    Z d   Z RS(   c         C` s   | |  _  | |  _ | |  _ d  S(   N(   t   fspatht   pmt   remove_mods(   t   selfR   R   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   __init__   s    		c         C` s,   |  j  j | d |  j } | |  j | <| S(   Nt   remove_plugins(   R   t   subset_hook_callerR   t   __dict__(   R   t   nameR   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   __getattr__   s    (   t   __name__t
   __module__R   R   (    (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR      s   	t   _CompatPropertyc           B` s   e  Z d    Z d   Z RS(   c         C` s   | |  _  d  S(   N(   R   (   R   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR      s    c         C` s&   | d  k r |  St t d  |  j  S(   NR;   (   R4   t   getattrR<   R   (   R   t   objt   owner(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   __get__   s    (   R   R   R   R   (    (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR      s   	t   NodeKeywordsc           B` sP   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   c         C` s,   | |  _  | j |  _ i t | j 6|  _ d  S(   N(   t   nodet   parentRo   R   t   _markers(   R   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR      s    	c         C` sG   y |  j  | SWn1 t k
 rB |  j d  k r4   n  |  j j | SXd  S(   N(   R   t   KeyErrorR   R4   t   keywords(   R   t   key(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   __getitem__   s    c         C` s   | |  j  | <d  S(   N(   R   (   R   R   RL   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   __setitem__   s    c         C` s   t  d   d  S(   Ns"   cannot delete key in keywords dict(   t
   ValueError(   R   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   __delitem__   s    c         C` s>   t  |  j  } |  j d  k	 r4 | j |  j j  n  t |  S(   N(   t   setR   R   R4   t   updateR   t   iter(   R   t   seen(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   __iter__   s    c         C` s   t  |  j    S(   N(   Rr   R   (   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   __len__   s    c         C` s
   t  |   S(   N(   t   list(   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   keys   s    c         C` s   d |  j  f S(   Ns   <NodeKeywords for node %s>(   R   (   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   __repr__   s    (
   R   R   R   R   R   R   R   R   R   R   (    (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR      s   							t   Nodec           B` s(  e  Z d  Z d d d d  Z e d    Z e d  Z e d  Z	 e d  Z
 e d  Z e d  Z e d  Z d	   Z d
   Z d   Z e d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d d  Z e Z  RS(   s~    base class for Collector and Item the test collection tree.
    Collector subclasses have children, Items are terminal nodes.c         C` ss   | |  _  | |  _ | p | j |  _ | p0 | j |  _ t | d d   |  _ t |   |  _ t	   |  _
 i  |  _ d  S(   NR   (   R   R   R=   R?   R   R4   R   R   R   R   t   extra_keyword_matchest   _name2pseudofixturedef(   R   R   R   R=   R?   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR     s    		c         C` s   |  j  j |  j  S(   s6    fspath sensitive hook proxy used to call pytest hooks(   R?   t   gethookproxyR   (   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   ihook  s    t   Modulet   Classt   Instancet   Functiont   Filet   Itemc         C` sJ   t  t |   |  } t | t  r7 t  t d  |  St  |  |  } | S(   NR;   (   R   R   RK   R   R<   (   R   R   t   maybe_compatpropt   cls(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   _getcustomclass)  s
    c         C` s    d |  j  j t |  d d   f S(   Ns   <%s %r>R   (   t	   __class__R   R   R4   (   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR   5  s    c         C` s   t  | t  s t  t |  d d  } | d k rH t |  d d  } n  |  j j j d t d | d | d |  j	 d |   d S(	   sK    generate a warning with the given code and message for this
        item. t   locationR   t   kwargst   codet   messaget   nodeidt
   fslocationN(
   RK   R1   t   AssertionErrorR   R4   R   t   pytest_logwarningt   call_historict   dictR   (   R   R   R   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   warn9  s    c         C` s7   y |  j  SWn% t k
 r2 |  j   |  _  } | SXd S(   s=    a ::-separated string denoting its collection tree address. N(   t   _nodeidt   AttributeErrort   _makeid(   R   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR   E  s
    c         C` s   |  j  j d |  j S(   Ns   ::(   R   R   R   (   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR   N  s    c         C` s   t  |  j  S(   N(   t   hashR   (   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   __hash__Q  s    c         C` s   d  S(   N(    (   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   setupT  s    c         C` s   d  S(   N(    (   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   teardownW  s    c         C` s   d | } t  |  | d   } | d  k	 rM t j j | d | d | d  n  t |  |  ri t  |  |  Sy |   } Wn? t j j k
 r   n& t j   } t	 |  | |    n Xt	 |  | |  | S(   Nt   _ex_i    i   i   (
   R   R4   R|   t   builtint   _reraiset   hasattrt   _sysexRN   t   exc_infot   setattr(   R   t   attrnamet   functiont
   exattrnamet   failuret   res(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   _memoizedcallZ  s     
%c         C` sC   g  } |  } x& | d k	 r4 | j |  | j } q W| j   | S(   se    return list of all parent collectors up to self,
            starting from root of collection tree. N(   R4   R$   R   t   reverse(   R   t   chainRk   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt	   listchainl  s    
c         C` so   d d l  m } m } t | t j j  r= t | |  } n t | |  s[ t d   n  | |  j	 | j
 <d S(   su    dynamically add a marker object to the node.

        ``marker`` can be a string or pytest.mark.* instance.
        i    (   t   MarkDecoratort   MARK_GENs'   is not a string or pytest.mark.* MarkerN(   t   _pytest.markR   R   RK   R|   R   t   _basestringR   R   R   R   (   R   t   markerR   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt
   add_markerw  s    c         C` sW   |  j  j | d  } | d k	 rS d d l m } m } t | | | f  rS | Sn  d S(   sf    get a marker object from this node or None if
        the node doesn't have a marker with that name. i    (   t   MarkInfoR   N(   R   t   getR4   R   R   R   RK   (   R   R   t   valR   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt
   get_marker  s
    c         C` s:   t    } |  } x$ |  j   D] } | j | j  q W| S(   s<    Return a set of all extra keywords in self and any parents.(   R   R   R   R   (   R   t   extra_keywordsRk   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   listextrakeywords  s
    	c         C` s    g  |  j    D] } | j ^ q S(   N(   R   R   (   R   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt	   listnames  s    c         C` s   |  j  j j | |   d S(   s    register a function to be called when this node is finalized.

        This method can only be called when this node is active
        in a setup chain, for example during self.setup().
        N(   R?   t   _setupstatet   addfinalizer(   R   t   fin(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR     s    c         C` s0   |  } x# | r+ t  | |  r+ | j } q	 W| S(   s]    get the next parent node (including ourself)
        which is an instance of the given class(   RK   R   (   R   R   t   current(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt	   getparent  s    c         C` s   d  S(   N(    (   R   R@   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   _prunetraceback  s    c         C` s@  |  j  j } | j | j  r+ | j j   St } |  j j j	 rI d } ne t
 j j | j d g  } |  j |  t | j  d k r | | _ n  t } | d k r d } n  | d  k r |  j j j d k r d } q d } n  y t j   t } Wn t k
 rt } n X| j d t d | d |  j j j d	 | d
 |  S(   Nt   longii    t   autot   shortt   funcargst   abspatht
   showlocalst   stylet   tbfilter(   R?   t   _fixturemanagerRY   t   FixtureLookupErrorRL   t
   formatreprRo   R=   RW   t	   fulltraceRH   RI   t	   Tracebackt	   tracebackR   Rr   R2   R4   t   tbstylet   ost   getcwdt   OSErrort   getreprR   (   R   R@   R   t   fmR   t   tbR   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   _repr_failure_py  s2    				


N(!   R   R   t   __doc__R4   R   t   propertyR   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R  t   repr_failure(    (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR      s8   																		 t	   Collectorc           B` s?   e  Z d  Z d e f d     YZ d   Z d   Z d   Z RS(   sf    Collector instances create children through collect()
        and thus iteratively build a tree.
    t   CollectErrorc           B` s   e  Z d  Z RS(   s8    an error during collection, contains a custom message. (   R   R   R  (    (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR
    s   c         C` s   t  d   d S(   sa    returns a list of children (items and collectors)
            for this collection node.
        t   abstractN(   t   NotImplementedError(   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR"     s    c         C` s?   | j  |  j  r, | j } t | j d  S|  j | d d S(   s!    represent a collection failure. i    R   R   (   RY   R
  RL   R1   R   R  (   R   R@   t   exc(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR    s    	c         C` sd   t  |  d  r` | j } | j d |  j  } | | k rN | j d t  } n  | j   | _ n  d  S(   NR   R%   t   excludepath(   R   R   t   cutR   t   tracebackcutdirt   filter(   R   R@   R   t
   ntraceback(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR     s    	(   R   R   R  RM   R
  R"   R  R   (    (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR	    s
   		t   FSCollectorc           B` s#   e  Z d d d d   Z d   Z RS(   c         C` s   t  j j |  } | j } | d  k	 r` | j | j  } | rH | } n  | j t j	 d  } n  t
 t |   j | | | |  | |  _ d  S(   Nt   /(   R|   R%   R}   t   basenameR4   t   reltoR   t   replaceR   t   sept   superR  R   (   R   R   R   R=   R?   R   t   rel(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR     s    		c         C` sC   |  j  j |  j j  } t j d k r? | j t j d  } n  | S(   NR  (   R   R  R=   t   rootdirR   R  R  (   R   t   relpath(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR     s    N(   R   R   R4   R   R   (    (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR    s   R   c           B` s   e  Z d  Z RS(   s.    base class for collecting tests from a file. (   R   R   R  (    (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR     s   R   c           B` sG   e  Z d  Z d Z d d d d  Z d   Z d   Z e d    Z	 RS(   sv    a basic test invocation item. Note that for a single function
    there might be multiple test invocation items.
    c         C` s,   t  t |   j | | | |  g  |  _ d  S(   N(   R  R   R   t   _report_sections(   R   R   R   R=   R?   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR     s    c         C` s&   | r" |  j  j | | | f  n  d  S(   N(   R  R$   (   R   t   whenR   t   content(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   add_report_section  s    c         C` s   |  j  d  d f S(   Nt    (   R   R4   (   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt
   reportinfo  s    c         C` s   y |  j  SWn t k
 r |  j   } |  j j j d i   } y | | d } Wn8 t k
 r |  j j j	 | d  } | | | d <n X| | d t
 | d  f } | |  _  | SXd  S(   Nt   _bestrelpathcachei    i   i   (   t	   _locationR   R"  R=   R   t
   setdefaultR   R?   R   t   bestrelpathR1   (   R   R   t   cacheR   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR     s    	N(
   R   R   R  R4   Rl   R   R   R"  R  R   (    (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR     s   		t   NoMatchc           B` s   e  Z d  Z RS(   s4    raised if matching cannot locate a matching names. (   R   R   R  (    (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR(     s   Rm   c           B` s   e  Z d  Z d Z RS(   s"    signals an interrupted test run. t   builtins(   R   R   R  (    (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyRm   #  s   RB   c           B` s   e  Z e Z d    Z d   Z e d e  d    Z e d e  d    Z e Z	 d   Z
 d   Z d e d  Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c      	   C` s   t  j |  | j d d  d | d |  d |  _ d |  _ t |  _ | j j	 j
 d  |  _ | j d  |  _ t j j   |  _ |  j j j |  d d d  S(   NR   R=   R?   i    R#   R
   R   (   R  R   R  R4   Rf   Rh   R2   Rt   t   tracet   rootR   t   getinit   _norecursepatternsR|   R%   R}   R[   R=   R~   t   register(   R   R=   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR   *  s    			c         C` s   d S(   NR!  (    (   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR   5  s    t   tryfirstc         C` s"   |  j  r |  j |  j    n  d  S(   N(   Rt   Rm   (   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   pytest_collectstart8  s    	c         C` si   | j  re t | d  re |  j d 7_ |  j j d  } | re |  j | k re d |  j |  _ qe n  d  S(   Nt   wasxfaili   R   s   stopping after %d failures(   t   failedR   Rf   R=   t   getvalueRt   (   R   t   reportR   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   pytest_runtest_logreport=  s    c         C` s   | |  j  k S(   N(   t   _initialpaths(   R   R%   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt
   isinitpathG  s    c         C` sX   |  j  j } | j |  } | j j |  } | rH t | | |  } n |  j  j } | S(   N(   R=   R~   t   _getconftestmodulest   _conftest_pluginst
   differenceR   RE   (   R   R   R   t   my_conftestmodulesR   t   proxy(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR   J  s    c         C` sx   |  j  j } zE |  j | |  } |  j  j j   | j d |  d |  j  d |  Wd  | j d |   Xt |  |  _ | S(   NR?   R=   Rq   (	   R=   RE   t   _perform_collectR~   t   check_pendingt   pytest_collection_modifyitemst   pytest_collection_finishRr   Rh   (   R   R   t   genitemsRE   Rq   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyRj   X  s    c         C` s  | d  k r |  j j } n  |  j d |  |  |  j j j d 7_ g  |  _ t   |  _ g  |  _	 g  |  _
 } xA | D]9 } |  j |  } |  j	 j |  |  j j | d  qu Wt |   } |  j j d |  |  j j j d 8_ |  j rLg  } xE |  j D]: \ } } d | | j d f }	 | j d | |	 f  q Wt |    n  | sY| j S| j rx- | j D] }
 |  j
 j |  j |
   qlWn  | Sd  S(   NRj   i   i    R4  s   (no name %r in any of %r)s   not found: %s
%s(   R4   R=   R   R*  R+  t   indentt	   _notfoundR   R6  t   _initialpartsRq   t	   _parseargR$   R   R   R   t   pytest_collectreportR   t   resultt   passedR{   RA  (   R   R   RA  Rq   t   argt   partst   rept   errorsR  t   lineR   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR=  d  s6    				 c         c` s   x |  j  D] } d j t t |   } |  j d |  |  j j j d 7_ y# x |  j |  D] } | Vq` WWn1 t k
 r |  j	 j
 | t j   d f  n X|  j j j d 8_ q
 Wd  S(   Ns   ::s   processing argumenti   (   RD  t   joint   mapR1   R*  R+  RB  t   _collectR(  RC  R$   RN   R   (   R   RJ  RI  R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR"     s    $c      	   c` s   |  j  |  } | j d  } | j d d  r | sJ t d | f   x | j d d   d |  j d t d	 t  D]% } x |  j |  D] } | Vq Wqu WnC | j d
 d  s t  x( |  j |  j |  |  D] } | Vq Wd  S(   Ni    R'   i   s   invalid arg %rt   filc         S` s   |  j  d d  S(   NR   i   (   t   check(   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   <lambda>  s    t   rect   bft   sortR   (	   RE  t   popRR  R   t   visitt   _recurseRo   t   _collectfilet
   matchnodes(   R   RI  t   namesR%   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyRP    s    "c         C` sV   |  j  |  } |  j |  s@ | j d | d |  j  r@ d Sn  | j d | d |   S(   NR%   R=   R   (    (   R   R7  R   R=   t   pytest_collect_file(   R   R%   R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyRZ    s
    c         C` s   |  j  | j    } | j d | d |  j  r4 d  Sx' |  j D] } | j d |  r> t Sq> W|  j  |  } | j d | d |   t S(   NR%   R=   t   fnmatchR   (	   R   Ry   R   R=   R-  RR  R2   t   pytest_collect_directoryRo   (   R   R%   R   t   pat(    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyRY    s    c         C` s   d d l  } y | j |  } Wn t k
 r3 | SX| d k rD | Sy | j |  } Wn% t k
 r~ | j | d j } n X| j |  r t	 j
 j |  } n  | S(   s/   Convert a dotted module name to path.

        i    N(   t   pkgutilt   find_loadert   ImportErrorR4   t   get_filenameR   t   modulest   co_filenamet
   is_packageR   R%   t   dirname(   R   R   Ra  t   loaderR%   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   _tryconvertpyarg  s    c         C` s   t  |  j d  } |  j j j r> |  j | d  | d <n  | d j d t j  } |  j j	 j
 | d t } | j   s |  j j j r t d | d   q t d |   n  | | d <| S(   s>    return (fspath, names) tuple after checking the file exists. s   ::i    R  t   abss   file or package not found: s    (missing __init__.py?)s   file not found: (   R1   t   splitR=   RW   t   pyargsRj  R  R   R  t   invocation_dirRN  Ro   RR  R   (   R   RI  RJ  R  R%   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyRE    s    
c         C` s   |  j  d | |  |  j  j j d 7_ |  j | |  } t |  } |  j  d | d  |  j  j j d 8_ | d k r t | | d    n  | S(   NR[  i   s   matchnodes finished -> t   nodesi    (   R*  R+  RB  t   _matchnodesRr   R(  (   R   t   matchingR\  Ro  R   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyR[    s    c   
      C` s|  | s | r | S| d } | s( t   | d } g  } x=| D]5} t | t  rp | s? | j |  q? q? n  t | t  s t   t |  } | j rat } xa | j D]V }	 |	 j	 | k s |	 j	 j
 d  d | k r | j |  j |	 g |   t } q q W| rtt | j  d k rt|	 j	 d k rt| j d |  | j |  j |	 g |   qtq? | j j d |  q? W| S(   Ni    i   t   [s   ()R4  (   R   RK   R   R$   R	  R   RH  R2   RG  R   Rl  R{   R[  Ro   Rr   t   insertR   RF  (
   R   Rq  R\  R   t	   nextnamest   resultnodesR   RK  t   has_matchedR   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyRp    s0    

	++"c         c` s   |  j  d |  t | t  r: | j j d |  | Vns t | t  sO t  t |  } | j r x3 | j	 D]% } x |  j
 |  D] } | Vq Wqn Wn  | j j d |  d  S(   NRA  Rk   R4  (   R*  RK   R   R   t   pytest_itemcollectedR	  R   R   RH  RG  RA  RF  (   R   R   RK  t   subnodeR   (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyRA    s    	N(   R   R   Rm   R   R   R   Ro   R0  R5  RF  R7  R   R4   Rj   R=  R"   RP  RZ  RY  Rj  RE  R[  Rp  RA  (    (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyRB   '  s&   													 (    (:   R  t
   __future__R    R   R   R5   R   RN   RH   t   _pytest._codeR|   t   collectionsR   t   MappingMixinRc  t   UserDictR   t   _pytest.configR   R   R   t   _pytest.runnerR   R	   R%   R}   t   __file__Ry   R  RC   Rg   RU   RX   t   EXIT_USAGEERRORRi   R9   R:   R>   Ra   Rc   Rb   Rd   Re   R   R   t   objectR   R   R   R	  R  R   R   RM   R(  RG   Rm   RB   (    (    (    s,   /tmp/pip-build-hU8Cw8/pytest/_pytest/main.pyt   <module>   sP   	3				'					$"