ó
£„öUc           @   sv   d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l m Z d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   baset   TestCorec           B   s;   e  Z d Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   t   pbr_test_cmdt   pbr_test_cmd_with_classc   	      C   s    x™ |  j  D]Ž } d | |  j f } |  j | | ƒ t j j |  j | ƒ } t | d ƒ j ƒ  } |  j d | ƒ |  j	 | ƒ \ } } } |  j d | ƒ q
 Wd  S(   Ns   Installing %s script to %st   rt   pkg_resourcest   PBR(
   t	   cmd_namest   temp_dirt   assertInt   ost   patht   joint   opent   readt   assertNotInt   _run_cmd(	   t   selft   install_stdoutt   cmd_namet   install_txtt   cmd_filenamet
   script_txtt   stdoutt   _t   return_code(    (    s7   /usr/lib/python2.7/dist-packages/pbr/tests/test_core.pyt   check_script_install6   s    c         C   s;   |  j  d ƒ |  j  d ƒ \ } } } | d k s7 t ‚ d S(   s‡   setup.py --keywords.

        Test that the `./setup.py --keywords` command returns the correct
        value without balking.
        t   egg_infos
   --keywordss   packaging,distutils,setuptoolsN(   t	   run_setupt   AssertionError(   R   R   R   (    (    s7   /usr/lib/python2.7/dist-packages/pbr/tests/test_core.pyt   test_setup_py_keywordsD   s    c         C   s¿   |  j  d d ƒ \ } } } y& t j t j j d d ƒ ƒ d } Wn# t k
 rf t sg t d ƒ ‚ n Xt j	 | ƒ } g  | j
 ƒ  D]" } d j | j d ƒ d ƒ ^ qƒ } |  j d	 | ƒ d
 S(   s.   Test that the extra files are correctly added.t   sdists   --formats=gztart   dists   *.tar.gzi    s   source dist not foundt   /i   s   extra-file.txtN(   R   t   globR
   R   R   t
   IndexErrort   FalseR   t   tarfileR   t   getnamest   splitR	   (   R   R   R   R   t   tf_patht   tft   pt   names(    (    s7   /usr/lib/python2.7/dist-packages/pbr/tests/test_core.pyt   test_sdist_extra_filesO   s    &5c         C   sk   t  j d k r |  j d ƒ n  |  j d d |  j ƒ \ } } } |  j t j d d ƒ ƒ |  j | ƒ d S(   s8   Test that we install a non-pkg-resources console script.t   nts   Windows support is passthrought   install_scriptss   --install-dir=%st
   PYTHONPATHt   .N(	   R
   t   namet   skipTestR   R   t
   useFixturet   fixturest   EnvironmentVariableR   (   R   R   R   R   (    (    s7   /usr/lib/python2.7/dist-packages/pbr/tests/test_core.pyt   test_console_script_install_   s    c         C   sr   t  j d k r |  j d ƒ n  |  j t j d d |  j ƒ ƒ |  j d d |  j ƒ \ } } } |  j | ƒ d S(   s8   Test that we develop a non-pkg-resources console script.R-   s   Windows support is passthroughR/   s   .:%st   develops   --install-dir=%sN(	   R
   R1   R2   R3   R4   R5   R   R   R   (   R   R   R   R   (    (    s7   /usr/lib/python2.7/dist-packages/pbr/tests/test_core.pyt   test_console_script_developm   s    (   R   R   (   t   __name__t
   __module__R   R   R   R,   R6   R8   (    (    (    s7   /usr/lib/python2.7/dist-packages/pbr/tests/test_core.pyR   2   s   				t   TestGitSDistc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s™   t  t |  ƒ j ƒ  |  j d d ƒ \ } } } | rD |  j d ƒ n  |  j d d ƒ \ } } } |  j d d ƒ \ } } } |  j d	 d
 ƒ \ } } } d  S(   Nt   gitt   inits   git not installedt   addR0   t   commits   -ms   Turn this into a git repoR   s   --formats=gztar(   R=   (   s   addR0   (   R?   s   -ms   Turn this into a git repo(   t   superR;   t   setUpR   R2   R   (   R   R   R   R   (    (    s7   /usr/lib/python2.7/dist-packages/pbr/tests/test_core.pyRA      s    c         C   sz   t  j  t j j d d ƒ ƒ d } t j | ƒ } g  | j ƒ  D]" } d j | j d ƒ d ƒ ^ q> } |  j d | ƒ d S(   s7   Test that extra files found in git are correctly added.R    s   *.tar.gzi    R!   i   s   git-extra-file.txtN(	   R"   R
   R   R   R%   R   R&   R'   R	   (   R   R(   R)   R*   R+   (    (    s7   /usr/lib/python2.7/dist-packages/pbr/tests/test_core.pyt   test_sdist_git_extra_filesŒ   s    "5(   R9   R:   RA   RB   (    (    (    s7   /usr/lib/python2.7/dist-packages/pbr/tests/test_core.pyR;   }   s   	(	   R"   R
   R%   R4   t	   pbr.testsR    t   BaseTestCaseR   R;   (    (    (    s7   /usr/lib/python2.7/dist-packages/pbr/tests/test_core.pyt   <module>)   s   K