ó
X¾÷Xc           @   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   sD   e  Z d 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(    (    s0   /tmp/pip-build-h1VYrz/pbr/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   (    (    s0   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_core.pyt   test_setup_py_keywordsD   s    c         C   s,   |  j  d ƒ \ } } } |  j d | ƒ d  S(   Nt   build_sphinxi    (   R   t   assertEqual(   R   R   R   R   (    (    s0   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_core.pyt   test_setup_py_build_sphinxO   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(    (    s0   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_core.pyt   test_sdist_extra_filesS   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   (    (    s0   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_core.pyt   test_console_script_installc   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.R0   s   Windows support is passthroughR2   s   .:%st   develops   --install-dir=%sN(	   R
   R4   R5   R6   R7   R8   R   R   R   (   R   R   R   R   (    (    s0   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_core.pyt   test_console_script_developq   s    (   R   R   (	   t   __name__t
   __module__R   R   R   R!   R/   R9   R;   (    (    (    s0   /tmp/pip-build-h1VYrz/pbr/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   addR3   t   commits   -ms   Turn this into a git repoR"   s   --formats=gztar(   s   init(   s   addR3   (   s   commits   -ms   Turn this into a git repo(   t   superR>   t   setUpR   R5   R   (   R   R   R   R   (    (    s0   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_core.pyRD   ƒ   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.   (    (    s0   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_core.pyt   test_sdist_git_extra_files   s    "5(   R<   R=   RD   RE   (    (    (    s0   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_core.pyR>      s   	(	   R%   R
   R(   R7   t	   pbr.testsR    t   BaseTestCaseR   R>   (    (    (    s0   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_core.pyt   <module>)   s   O