ó
Š]c           @   s¾   d  Z  d d l Z d d l Z d d l Z d d l m Z d d l m Z m Z d d l	 m
 Z
 d d l m Z d e
 j e
 j e j f d „  ƒ  YZ d	 „  Z e d
 k rº e e ƒ  ƒ n  d S(   s#   Tests for distutils.command.config.iÿÿÿÿN(   t   run_unittest(   t	   dump_filet   config(   t   support(   t   logt   ConfigTestCasec           B   sb   e  Z d  „  Z d „  Z d „  Z d „  Z e j e j	 d k d ƒ d „  ƒ Z
 d „  Z d „  Z RS(	   c         G   s+   x$ | j  ƒ  D] } |  j j | ƒ q Wd  S(   N(   t
   splitlinest   _logst   append(   t   selft   msgt   argst   line(    (    s0   lib/python2.7/distutils/tests/test_config_cmd.pyt   _info   s    c         C   s8   t  t |  ƒ j ƒ  g  |  _ t j |  _ |  j t _ d  S(   N(   t   superR   t   setUpR   R   t   infot   old_logR   (   R	   (    (    s0   lib/python2.7/distutils/tests/test_config_cmd.pyR      s    	c         C   s#   |  j  t _ t t |  ƒ j ƒ  d  S(   N(   R   R   R   R   R   t   tearDown(   R	   (    (    s0   lib/python2.7/distutils/tests/test_config_cmd.pyR      s    c         C   sx   t  j j t ƒ d d } t | ƒ } z t | j ƒ  ƒ } Wd  | j ƒ  Xt | d ƒ |  j	 t |  j
 ƒ | d ƒ d  S(   Ni    s   .pys   I am the headeri   (   t   ost   patht   splitextt   __file__t   opent   lent	   readlinest   closeR   t   assertEqualR   (   R	   t	   this_filet   ft   numlines(    (    s0   lib/python2.7/distutils/tests/test_config_cmd.pyt   test_dump_file   s    t   win32s   can't test on Windowsc         C   sr   |  j  ƒ  \ } } t | ƒ } | j d d d d ƒ } |  j | d ƒ | j d d d d ƒ } |  j | d ƒ d  S(   Nt   patternt   xxxt   bodys	   /* xxx */i    t   _configtesti   (   t   create_distR   t
   search_cppR   (   R	   t   pkg_dirt   distt   cmdt   match(    (    s0   lib/python2.7/distutils/tests/test_config_cmd.pyt   test_search_cpp(   s    c         C   s   |  j  ƒ  \ } } t | ƒ } d t j | _ d | _ d t j | _ | j ƒ  |  j | j d d g ƒ |  j | j d g ƒ |  j | j d d g ƒ d  S(   Ns   one%stwot   ones   three%sfourt   twot   threet   four(	   R%   R   R   t   pathsept   include_dirst	   librariest   library_dirst   ensure_finalizedR   (   R	   R'   R(   R)   (    (    s0   lib/python2.7/distutils/tests/test_config_cmd.pyt   test_finalize_options4   s    	
c         C   sè   |  j  ƒ  } t j j | d ƒ } t j j | d ƒ } |  j | d ƒ |  j | d ƒ x- | | f D] } |  j t j j | ƒ ƒ qc W|  j ƒ  \ } } t | ƒ } | j	 | | ƒ x- | | f D] } |  j
 t j j | ƒ ƒ qÁ Wd  S(   NR,   R-   R"   (   t   mkdtempR   R   t   joint
   write_filet
   assertTruet   existsR%   R   t   _cleant   assertFalse(   R	   t   tmp_dirt   f1t   f2R   R'   R(   R)   (    (    s0   lib/python2.7/distutils/tests/test_config_cmd.pyt
   test_cleanB   s    (   t   __name__t
   __module__R   R   R   R   t   unittestt   skipIft   syst   platformR+   R5   R@   (    (    (    s0   lib/python2.7/distutils/tests/test_config_cmd.pyR      s   				$	c           C   s   t  j t ƒ S(   N(   RC   t	   makeSuiteR   (    (    (    s0   lib/python2.7/distutils/tests/test_config_cmd.pyt
   test_suiteU   s    t   __main__(   t   __doc__RC   R   RE   t   test.test_supportR    t   distutils.command.configR   R   t   distutils.testsR   t	   distutilsR   t   LoggingSilencert   TempdirManagert   TestCaseR   RH   RA   (    (    (    s0   lib/python2.7/distutils/tests/test_config_cmd.pyt   <module>   s   	H	