ó
X¾÷Xc           @   su   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 e j f d „  ƒ  YZ	 d S(   iÿÿÿÿN(   t   content(   t   matchers(   t   base(   t   utilt	   TestHooksc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   sz   t  t |  ƒ j ƒ  t j t j j |  j d ƒ ƒ @ } | j	 d d d ƒ | j	 d d d ƒ | j	 d d d	 ƒ Wd  QXd  S(
   Ns	   setup.cfgt   globals   setup-hookssQ   pbr_testpackage._setup_hooks.test_hook_1
pbr_testpackage._setup_hooks.test_hook_2t	   build_exts   pre-hook.test_pre_hooks*   pbr_testpackage._setup_hooks.test_pre_hooks   post-hook.test_post_hooks+   pbr_testpackage._setup_hooks.test_post_hook(
   t   superR   t   setUpR   t   open_configt   ost   patht   joint   package_dirt   set(   t   selft   cfg(    (    s1   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_hooks.pyR   4   s    c         C   s@   |  j  d ƒ \ } } } d | k s* t ‚ | d k s< t ‚ d S(   s„   Test setup_hooks.

        Test that setup_hooks listed in the [global] section of setup.cfg are
        executed in order.
        t   egg_infos   test_hook_1
test_hook_2i    N(   t	   run_setupt   AssertionError(   R   t   stdoutt   _t   return_code(    (    s1   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_hooks.pyt   test_global_setup_hooks@   s    c         C   sÉ   |  j  d ƒ \ } } } d | k s* t ‚ d | k s< t ‚ | d k sN t ‚ |  j  d ƒ \ } } } |  j d t j | ƒ ƒ t j d ƒ | k sš t ‚ |  j | t j	 d ƒ ƒ | d k sÅ t ‚ d S(	   s‘   Test command hooks.

        Simple test that the appropriate command hooks run at the
        beginning/end of the appropriate command.
        R   s   build_ext pre-hooks   build_ext post-hooki    R   t   stderrs¤   
            running build_ext
            running pre_hook pbr_testpackage._setup_hooks.test_pre_hook for command build_ext
            build_ext pre-hook
        N(
   R   R   t   addDetailUniqueNameR    t   text_contentt   textwrapt   dedentt
   expectThatR   t   EndsWith(   R   R   R   R   R   (    (    s1   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_hooks.pyt   test_command_hooksK   s    c         C   sB   |  j  d ƒ \ } } } |  j | ƒ |  j | t j d ƒ ƒ d  S(   Ns   --help-commandss    testr (   R   t   assertFalset
   assertThatR   t   Contains(   R   R   R   R   (    (    s1   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_hooks.pyt   test_custom_commands_knowna   s    (   t   __name__t
   __module__R   R   R   R#   (    (    (    s1   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_hooks.pyR   3   s   			(
   R
   R   t	   testtoolsR    R   t	   pbr.testsR   R   t   BaseTestCaseR   (    (    (    s1   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_hooks.pyt   <module>)   s   