ó
OyTLc           @   s|   d  d l  m Z d  d l m Z d  d l Z d  d l Td  d l m Z m Z d e f d „  ƒ  YZ	 d e f d	 „  ƒ  YZ
 d S(
   iÿÿÿÿ(   t   Command(   t   DistutilsOptionErrorN(   t   *(   t
   TestLoadert   maint   ScanningLoaderc           B   s   e  Z d  „  Z RS(   c         C   s&  g  } | j  d k r1 | j t j |  | ƒ ƒ n  t | d ƒ rV | j | j ƒ  ƒ n  t | d ƒ rû x“ t | j  d ƒ D]| } | j d ƒ r± | d k r± | j  d | d  } n- t | j  | d	 ƒ rx | j  d | } n qx | j |  j	 | ƒ ƒ qx 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.
        s   setuptools.tests.doctestt   additional_testst   __path__t    s   .pys   __init__.pyt   .iýÿÿÿs   /__init__.pyi   i    N(   t   __name__t   appendR   t   loadTestsFromModulet   hasattrR   t   resource_listdirt   endswitht   resource_existst   loadTestsFromNamet   lent
   suiteClass(   t   selft   modulet   testst   filet	   submodule(    (    s;   /usr/lib/python2.7/dist-packages/setuptools/command/test.pyR   	   s"    (   R
   t
   __module__R   (    (    (    s;   /usr/lib/python2.7/dist-packages/setuptools/command/test.pyR      s   t   testc           B   sM   e  Z d  Z d Z d d g Z d „  Z d	 „  Z d
 „  Z d „  Z 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')c         C   s   d  |  _ d  |  _ d  |  _ d  S(   N(   t   Nonet
   test_suitet   test_modulet   test_loader(   R   (    (    s;   /usr/lib/python2.7/dist-packages/setuptools/command/test.pyt   initialize_options6   s    		c         C   sÒ   |  j  d  k rC |  j d  k r0 |  j j  |  _  q[ |  j d |  _  n |  j r[ t d ƒ ‚ n  |  j  g |  _ |  j r‰ |  j j d d ƒ n  |  j d  k r³ t	 |  j d d  ƒ |  _ n  |  j d  k rÎ d |  _ n  d  S(   Ns   .test_suites1   You may specify a module or a suite, but not bothi    s	   --verboseR    s&   setuptools.command.test:ScanningLoader(
   R   R   R   t   distributionR   t	   test_argst   verboset   insertR    t   getattr(   R   (    (    s;   /usr/lib/python2.7/dist-packages/setuptools/command/test.pyt   finalize_options<   s    		c         C   s|  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 ƒ  } zX t j	 j d t | j ƒ ƒ t j ƒ  t d	 „  ƒ t d
 | j | j f ƒ | ƒ  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;   /usr/lib/python2.7/dist-packages/setuptools/command/test.pyt   <lambda>s   s    s   %s==%s(   R&   R"   t   Falset   reinitialize_commandt   run_commandt   get_finalized_commandt   normalize_patht	   build_libt   syst   patht   modulest   copyR%   R,   t   working_sett   __init__t   add_activation_listenert   requiret   egg_namet   egg_versiont   cleart   update(   R   t   funct   bpy_cmdt
   build_patht   ei_cmdt   old_patht   old_modules(    (    s;   /usr/lib/python2.7/dist-packages/setuptools/command/test.pyt   with_project_on_sys_pathS   s2    


c         C   sª   |  j  j r% |  j  j |  j  j ƒ n  |  j  j rJ |  j  j |  j  j ƒ n  |  j r¦ d j |  j ƒ } |  j r‚ |  j d | ƒ q¦ |  j d | ƒ |  j	 |  j
 ƒ n  d  S(   Nt    s    skipping "unittest %s" (dry run)s   running "unittest %s"(   R"   t   install_requirest   fetch_build_eggst   tests_requireR   t   joinR#   t   dry_runt   announceRI   t	   run_tests(   R   t   cmd(    (    s;   /usr/lib/python2.7/dist-packages/setuptools/command/test.pyt   run}   s    		c         C   sa   d d  l  } t j d |  j ƒ } | j d t ƒ } | j d  d  | j g |  j	 d | ƒ  ƒd  S(   Niÿÿÿÿs   x=R>   t
   testLoader(
   t   unittestt
   EntryPointt   parseR    t   loadR1   R   R   t   __file__R#   (   R   RU   t	   loader_ept   loader_class(    (    s;   /usr/lib/python2.7/dist-packages/setuptools/command/test.pyRQ   Œ   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')(
   R
   R   t   __doc__t   descriptiont   user_optionsR!   R'   RI   RS   RQ   (    (    (    s;   /usr/lib/python2.7/dist-packages/setuptools/command/test.pyR   *   s    				*	(   t
   setuptoolsR    t   distutils.errorsR   R7   t   pkg_resourcesRU   R   R   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/setuptools/command/test.pyt   <module>   s   
#