ó
.¿”Wc           @   sø   d  d l  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 m Z m Z m Z m Z m Z m Z m Z d  d l m Z d  d l m Z d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   DistutilsOptionError(   t
   TestLoader(   t   six(   t   map(   t   resource_listdirt   resource_existst   normalize_patht   working_sett   _namespace_packagest   add_activation_listenert   requiret
   EntryPoint(   t   Command(   t   unittest_maint   ScanningLoaderc           B   s   e  Z d d  „ Z RS(   c         C   s  g  } | j  t j |  | ƒ ƒ t | d ƒ rD | j  | j ƒ  ƒ n  t | d ƒ ré x“ t | j d ƒ D]| } | j d ƒ rŸ | d k rŸ | j d | d  } n- t | j | d ƒ rf | j d | } n qf | j  |  j	 | ƒ ƒ qf Wn  t
 | ƒ d	 k r|  j | ƒ S| d
 Sd S(   s  Return a suite of all tests cases contained in the given module

        If the module is a package, load tests from all the modules in it.
        If the module has an ``additional_tests`` function, call it and add
        the return value to the tests.
        t   additional_testst   __path__t    s   .pys   __init__.pyt   .iýÿÿÿs   /__init__.pyi   i    N(   t   appendR   t   loadTestsFromModulet   hasattrR   R   t   __name__t   endswithR   t   loadTestsFromNamet   lent
   suiteClass(   t   selft   modulet   patternt   testst   filet	   submodule(    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyR      s    N(   R   t
   __module__t   NoneR   (    (    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyR      s   t   NonDataPropertyc           B   s   e  Z d  „  Z d d „ Z RS(   c         C   s   | |  _  d  S(   N(   t   fget(   R   R$   (    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyt   __init__3   s    c         C   s   | d  k r |  S|  j | ƒ S(   N(   R"   R$   (   R   t   objt   objtype(    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyt   __get__6   s    N(   R   R!   R%   R"   R(   (    (    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyR#   1   s   	t   testc           B   s˜   e  Z d  Z d Z d d d g Z d „  Z d „  Z e d „  ƒ Z d „  Z	 d „  Z
 e j d „  ƒ Z d „  Z d „  Z e d „  ƒ Z e d „  ƒ Z RS(   s.   Command to run unit tests after in-place builds#   run unit tests after in-place builds   test-module=t   ms$   Run 'test_suite' in specified modules   test-suite=t   ss1   Test suite to run (e.g. 'some_module.test_suite')s   test-runner=t   rs   Test runner to usec         C   s(   d  |  _ d  |  _ d  |  _ d  |  _ d  S(   N(   R"   t
   test_suitet   test_modulet   test_loadert   test_runner(   R   (    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyt   initialize_optionsH   s    			c         C   sÝ   |  j  r' |  j r' d } t | ƒ ‚ n  |  j  d  k rj |  j d  k rW |  j j  |  _  qj |  j d |  _  n  |  j d  k r” t |  j d d  ƒ |  _ n  |  j d  k r¯ d |  _ n  |  j d  k rÙ t |  j d d  ƒ |  _ n  d  S(   Ns1   You may specify a module or a suite, but not boths   .test_suiteR/   s&   setuptools.command.test:ScanningLoaderR0   (   R-   R.   R    R"   t   distributionR/   t   getattrR0   (   R   t   msg(    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyt   finalize_optionsN   s    c         C   s   t  |  j ƒ  ƒ S(   N(   t   listt
   _test_args(   R   (    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyt	   test_argsa   s    c         c   s)   |  j  r d Vn  |  j r% |  j Vn  d  S(   Ns	   --verbose(   t   verboseR-   (   R   (    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyR7   e   s    		c         C   s   |  j  ƒ   | ƒ  Wd QXd S(   sI   
        Backward compatibility for project_on_sys_path context.
        N(   t   project_on_sys_path(   R   t   func(    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyt   with_project_on_sys_pathk   s    c         c   s‰  t  j o t |  j d t ƒ } | r¥ |  j d d d ƒ|  j d ƒ |  j d ƒ } t | j	 ƒ } |  j d d | ƒ|  j d ƒ |  j d d d ƒ|  j d ƒ n- |  j d ƒ |  j d d d ƒ|  j d ƒ |  j d ƒ } t
 j } t
 j j ƒ  } zV t
 j j d t | j ƒ ƒ t j ƒ  t d	 „  ƒ t d
 | j | j f ƒ d  VWd  | t
 j (t
 j j ƒ  t
 j j | ƒ t j ƒ  Xd  S(   Nt   use_2to3t   build_pyt   inplacei    t   egg_infot   egg_baset	   build_exti   c         S   s
   |  j  ƒ  S(   N(   t   activate(   t   dist(    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyt   <lambda>•   s    s   %s==%s(   R   t   PY3R3   R2   t   Falset   reinitialize_commandt   run_commandt   get_finalized_commandR   t	   build_libt   syst   patht   modulest   copyt   insertRA   R   R%   R	   R
   t   egg_namet   egg_versiont   cleart   update(   R   t	   with_2to3t   bpy_cmdt
   build_patht   ei_cmdt   old_patht   old_modules(    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyR:   r   s4    

	
c         C   s¬   |  j  j r% |  j  j |  j  j ƒ n  |  j  j rJ |  j  j |  j  j ƒ n  d j |  j ƒ } |  j rz |  j d | ƒ d  S|  j d | ƒ |  j ƒ   |  j	 ƒ  Wd  QXd  S(   Nt    s   skipping "%s" (dry run)s   running "%s"(
   R2   t   install_requirest   fetch_build_eggst   tests_requiret   joint   _argvt   dry_runt   announceR:   t	   run_tests(   R   t   cmd(    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyt   runž   s    		c      	   C   sü   t  j rÁ t |  j d t ƒ rÁ |  j j d ƒ d } | t k rÁ g  } | t j	 k re | j
 | ƒ n  | d 7} x0 t j	 D]% } | j | ƒ ry | j
 | ƒ qy qy Wt t t j	 j | ƒ ƒ qÁ n  t d  d  |  j d |  j |  j ƒ d |  j |  j ƒ ƒd  S(   NR=   R   i    t
   testLoadert
   testRunner(   R   RF   R3   R2   RG   R-   t   splitR   RL   RN   R   t
   startswithR6   R   t   __delitem__R   R"   R`   t   _resolve_as_epR/   R0   (   R   R   t   del_modulest   name(    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyRc   ®   s    
c         C   s   d g |  j  S(   Nt   unittest(   R8   (   R   (    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyR`   Ä   s    c         C   s0   |  d k r d St j d |  ƒ } | j ƒ  ƒ  S(   su   
        Load the indicated attribute value, called, as a as if it were
        specified as an entry point.
        Ns   x=(   R"   R   t   parset   resolve(   t   valt   parsed(    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyRk   È   s    (   s   test-module=R*   s$   Run 'test_suite' in specified module(   s   test-suite=R+   s1   Test suite to run (e.g. 'some_module.test_suite')(   s   test-runner=R,   s   Test runner to use(   R   R!   t   __doc__t   descriptiont   user_optionsR1   R5   R#   R8   R7   R<   t
   contextlibt   contextmanagerR:   Re   Rc   t   propertyR`   t   staticmethodRk   (    (    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyR)   <   s     					,		(   RL   Rv   t   distutils.errorsR    Rn   R   t   setuptools.externR   t   setuptools.extern.six.movesR   t   pkg_resourcesR   R   R   R   R   R	   R
   R   t
   setuptoolsR   t   setuptools.py31compatR   R   t   objectR#   R)   (    (    (    s;   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/test.pyt   <module>   s   :!