ó
OyTLc           @   s`  d  Z  d d l m Z m Z m Z m Z d d l Z d d l Z d d l	 m
 Z
 m Z d d l	 m Z d d l Z d d l Z d d l m Z d d l m Z d \ Z Z d d l Td d	 l m Z m Z d d
 l m Z d d l Z d d l Z d „  Z d „  Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ  d e f d „  ƒ  YZ! d e f d „  ƒ  YZ" d S(   s"   Tests for the 'setuptools' packageiÿÿÿÿ(   t	   TestSuitet   TestCaset	   makeSuitet   defaultTestLoaderN(   t   DistutilsOptionErrort   DistutilsPlatformError(   t   DistutilsSetupError(   t   Feature(   t	   Extension(   t   *(   t   StrictVersiont   LooseVersion(   t   convert_pathc          C   s}   d d  l  }  d d  l } | j |  j t j j d d ƒ d |  j d d ƒf ƒ } t j	 d k ry | j
 |  j d ƒ ƒ n  | S(	   Niÿÿÿÿt   testss   api_tests.txtt   optionflagst   packaget   pkg_resourcest   win32s   win_script_wrapper.txt(   t   doctestt   unittestR    t   DocFileSuitet   ost   patht   joint   ELLIPSISt   syst   platformt   addTest(   R   R   t   suite(    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   additional_tests   s    c          K   sA   d t  j _ |  j d d g ƒ z t j |    SWd d t  _ Xd S(   sD   Return distribution from 'setup(**args)', without executing commandst   commandlinet   script_argst   installN(   t	   distutilst   coret   _setup_stop_aftert
   setdefaultt
   setuptoolst   setupt   Nonet   core_setup_stop_after(   t   args(    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt	   makeSetup   s
    t   DependsTestsc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   s“   t  s
 d  Sd „  } |  j t  | j d d ƒ d  ƒ |  j t  | j d d ƒ d ƒ |  j t  | j d d ƒ d ƒ |  j t  | j d d ƒ d  ƒ d  S(   Nc           S   s   d a  t a d  S(   Nt   test(   t   xt   zt   y(    (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   f10   s    t   qiÿÿÿÿR-   R,   R/   R.   (   t   extract_constantt   assertEqualt	   func_codeR'   (   t   selfR0   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testExtractConst-   s     	c         C   sI   |  j  t t d ƒ |  j  t t d ƒ t d ƒ \ } } } | j ƒ  d  S(   Ns   no-such.-things   setuptools.non-existents   setuptools.tests(   t   assertRaisest   ImportErrort   find_modulet   close(   R5   t   ft   pt   i(    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testFindModuleB   s     c         C   sl   t  s
 d  Sd d l m } |  j t  d d ƒ | ƒ |  j t  d d ƒ t j ƒ |  j t  d d ƒ t ƒ d  S(	   Niÿÿÿÿ(   t   __version__t   emailR?   R   t   versions   setuptools.testst   __doc__(   t   get_module_constantR@   R?   R3   R   RA   RB   (   R5   R?   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testModuleExtractG   s     c         C   sm  t  s
 d  St d d d ƒ } |  j | j d ƒ |  j | j d ƒ |  j | j d ƒ |  j | j d ƒ |  j | j ƒ  d ƒ d d l m	 } |  j | j
 ƒ  | ƒ |  j | j d ƒ ƒ |  j | j d	 ƒ ƒ |  j | j d
 ƒ ƒ |  j | j ƒ  ƒ |  j | j ƒ  ƒ t d d d d t ƒ} |  j | j ƒ  ƒ |  j | j ƒ  ƒ |  j | j d
 ƒ ƒ t d d d ƒ } |  j | j ƒ  ƒ |  j | j ƒ  ƒ t d d  d d d ƒ} |  j | j d  ƒ |  j | j d  ƒ |  j | j d  ƒ |  j | j ƒ  d ƒ |  j | j d ƒ g  t D] } t j j | ƒ ^ q} |  j | j | ƒ ƒ |  j | j | ƒ ƒ d  S(   Nt   Emails   1.0.3R@   R?   s   Email-1.0.3iÿÿÿÿ(   R?   s   1.0.9s   0.9.1t   unknowns
   Email 3000t   03000t   formats   Do-what-I-means   1.0s   d-w-i-mt   TestsR   t   homepages   http://example.com(   R2   t   RequireR3   t   namet   modulet   requested_versiont	   attributet	   full_nameR@   R?   t   get_versiont   assert_t
   version_okt
   is_presentt
   is_currentR   R'   RH   RJ   t   __path__R   R   t   dirname(   R5   t   reqR?   R<   t   paths(    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testRequireT   s>     %(   t   __name__t
   __module__R6   R>   RD   RZ   (    (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyR+   +   s   			t   DistroTestsc           B   sP   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(   c      	   C   ss   t  d d g ƒ |  _ t  d d g ƒ |  _ t d d d d d	 d
 g d d d g d |  j |  j f d i  ƒ |  _ d  S(   Ns   bar.exts   bar.cs   c.ys   y.ct   packagest   as   a.bs   a.b.ct   bt   ct
   py_moduless   b.dR-   t   ext_modulest   package_dir(   R   t   e1t   e2R*   t   dist(   R5   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   setUp   s    c         C   s#   |  j  t |  j t j j ƒ ƒ d  S(   N(   RR   t
   isinstanceRg   R%   t   Distribution(   R5   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testDistroType‹   s    c         C   sÿ   |  j  j d ƒ |  j |  j  j d d g ƒ |  j  j d ƒ |  j |  j  j d g ƒ |  j |  j  j d g ƒ |  j |  j  j |  j |  j g ƒ |  j  j d ƒ |  j |  j  j g  ƒ |  j |  j  j d g ƒ |  j |  j  j |  j g ƒ t ƒ  j d ƒ d  S(   NR_   R`   Ra   R-   (	   Rg   t   exclude_packageR3   R^   Rb   Rc   Re   Rf   R*   (   R5   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testExcludePackage   s    "c         C   s¯   |  j  j d |  j g ƒ |  j |  j  j |  j g ƒ |  j  j d |  j g ƒ |  j |  j  j |  j |  j g ƒ |  j  j d |  j g ƒ |  j |  j  j |  j |  j g ƒ d  S(   NRc   (   Rg   t   excludeRe   R3   Rc   Rf   t   include(   R5   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testIncludeExclude¦   s    "c         C   sk   |  j  j d d d d g ƒ |  j |  j  j g  ƒ |  j |  j  j d g ƒ |  j |  j  j |  j g ƒ d  S(   NR^   Ra   R`   R_   R-   (   Rg   Rn   R3   R^   Rb   Rc   Re   (   R5   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testExcludePackages³   s    c         C   sf   t  ƒ  } | j d d g d d g d |  j g ƒ t  ƒ  } | j d d g d d g d |  j g ƒ d  S(   NR^   R_   Rb   R`   Rc   (   R*   Ro   Rf   Rn   (   R5   Rg   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt	   testEmpty¹   s    	(	c         C   sÍ   |  j  |  j j d ƒ ƒ |  j j d ƒ |  j  |  j j d ƒ ƒ |  j  |  j j d ƒ ƒ |  j j d ƒ |  j  |  j j d ƒ ƒ |  j  |  j j d ƒ ƒ |  j j d ƒ |  j  |  j j d ƒ ƒ d  S(   NR_   R`   Ra   (   RR   Rg   t   has_contents_forRl   (   R5   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testContents¿   s    c         C   s  |  j  t |  j j d d ƒ|  j  t |  j j d d ƒ|  j  t |  j j d i d d 6ƒ|  j  t |  j j d i d d 6ƒ|  j  t |  j j d i d d 6ƒ|  j  t |  j j d i d d 6ƒ|  j  t |  j j d d g ƒ|  j  t |  j j d d g ƒd  S(   Nt   nonexistent_optionR-   R^   R/   Rc   Rd   R1   (   R7   R   Rg   Ro   Rn   (   R5   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testInvalidIncludeExcludeÏ   s     								(
   R[   R\   Rh   Rk   Rm   Rp   Rq   Rr   Rt   Rv   (    (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyR]   }   s   							t   FeatureTestsc           B   s>   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   sû   t  d d d ƒ |  _ t d i t d d t d d |  j g ƒd 6t d	 d t d
 d g d d g d d g ƒd	 6t d d t d
 d g d d g d d! g ƒd 6t d d t d d ƒd 6d d d g d
 d d g d d d g d t d d  g ƒ g ƒ |  _ d  S("   Nt	   Distutilss   1.0.3R!   t   featurest   foot   standardt   require_featurest   bazt   barR^   s   pkg.barRb   t   bar_ett   removes   bar.extt   optionals   pkg.bazt   scriptss   scripts/baz_itt	   librariest   libfoos   foo/foofoo.ct   DWIMt	   availablet   bazisht   dwimR   s   --without-barR    s   pkg.fooRc   s   bar.c(   R„   s   foo/foofoo.c(   RK   RX   R*   R   t   Truet   FalseR   Rg   (   R5   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyRh   ú   s    "	c      	   C   sh   |  j  t d d t d d d t ƒj ƒ  ƒ |  j  t d d t d d ƒj ƒ  ƒ |  j t t d ƒ d  S(   NR,   R{   R€   R-   R†   (   RR   R   R‰   RŠ   t   include_by_defaultR7   R   (   R5   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testDefaults  s    #c         C   s'   |  j  t |  j j d j |  j ƒ d  S(   NRˆ   (   R7   R   Rg   Ry   t
   include_in(   R5   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testAvailability  s    c         C   sÀ   |  j  } |  j d | j k ƒ |  j d | j k ƒ |  j d | j k ƒ |  j d | j k ƒ |  j | j d	 d
 ƒ |  j | j d d ƒ |  j | j d d ƒ |  j d | j k ƒ d  S(   Ns	   with-dwims   include DWIMs   without-dwims   exclude DWIM (default)s   with-bars   include bar (default)s   without-bars   exclude bars   without-foos   with-foos   without-baz(   s	   with-dwimNs   include DWIM(   s   without-dwimNs   exclude DWIM (default)(   s   with-barNs   include bar (default)(   s   without-barNs   exclude bar(   Rg   RR   R'   t   feature_optionsR3   t   feature_negopt(   R5   Rg   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testFeatureOptions!  s    	c         C   sö   |  j  } |  j | j d ƒ |  j | j d ƒ |  j | j d ƒ |  j d | j k ƒ |  j d | j k ƒ |  j d | j k ƒ |  j d | j k ƒ |  j d
 | j	 k ƒ |  j | j
 g  ƒ |  j | j |  j g ƒ |  j t | j d	 ƒ d  S(   Ni   i    R   s   pkg.bars   pkg.bazs   scripts/baz_itR„   s   foo/foofoo.cR~   (   s   libfoos   foo/foofoo.c(   Rg   R3   t   with_foot   with_bart   with_bazRR   Rb   R^   R‚   Rƒ   Rc   R|   RX   R7   R   t   include_feature(   R5   Rg   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testUseFeatures4  s    	c      	   C   s-   |  j  t t d i t d d d ƒd 6ƒd  S(   NRy   R-   R€   R/   (   R7   t
   SystemExitR*   R   (   R5   (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testFeatureWithInvalidRemoveE  s    (   R[   R\   Rh   RŒ   RŽ   R‘   R–   R˜   (    (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyRw   ø   s   					t   TestCommandTestsc           B   s>   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s2   t  ƒ  j d ƒ } |  j t | t j j ƒ ƒ d  S(   NR,   (   R*   t   get_command_objRR   Ri   R!   t   cmdt   Command(   R5   t   test_cmd(    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testTestIsCommandL  s    c         C   sE   t  d d d g ƒ } | j d ƒ } | j ƒ  |  j | j d ƒ d  S(   NR   R,   s   --test-suite=foo.tests.suites   foo.tests.suite(   R*   Rš   t   ensure_finalizedR3   t
   test_suite(   R5   t   ts1(    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testLongOptSuiteWNoDefaultP  s    
c         C   s9   t  d d ƒ j d ƒ } | j ƒ  |  j | j d ƒ d  S(   NR    s   bar.tests.suiteR,   (   R*   Rš   RŸ   R3   R    (   R5   t   ts2(    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testDefaultSuiteV  s    
c         C   s[   t  d d d d d d g ƒ j d ƒ } | j ƒ  |  j | j d ƒ |  j | j d ƒ d  S(   NR    s	   bar.testsR   R,   s   -ms	   foo.testss   foo.tests.test_suite(   R*   Rš   RŸ   R3   t   test_moduleR    (   R5   t   ts3(    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testDefaultWModuleOnCmdLine[  s    	
c         C   s>   t  d d d d d d g ƒ j d ƒ } |  j t | j ƒ d  S(   NR   R,   s   -ms	   bar.testss   -ss   foo.tests.suite(   R*   Rš   R7   R   RŸ   (   R5   t   ts4(    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testConflictingOptionsd  s    	c         C   s3   t  ƒ  j d ƒ } | j ƒ  |  j | j d  ƒ d  S(   NR,   (   R*   Rš   RŸ   R3   R    R'   (   R5   t   ts5(    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   testNoSuitej  s    
(   R[   R\   Rž   R¢   R¤   R§   R©   R«   (    (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyR™   J  s   						(   NN(#   RB   R   R    R   R   R   t   distutils.coreR!   t   distutils.cmdt   distutils.errorsR   R   R   R%   t   setuptools.distR   R   R'   R2   RC   t   setuptools.dependst   distutils.versionR
   R   t   distutils.utilR   R   t   os.pathR   R   R*   R+   R]   Rw   R™   (    (    (    s=   /usr/lib/python2.7/dist-packages/setuptools/tests/__init__.pyt   <module>   s$   "
		R{R