ó
’wÛjc           @   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 y d d l Z Wn e k
 r™ d Z n Xe j j e ƒ 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.check.iÿÿÿÿN(   t   run_unittest(   t   checkt   HAS_DOCUTILS(   t   support(   t   DistutilsSetupErrort   CheckTestCasec           B   sz   e  Z d d d  „ Z d „  Z e j e d ƒ d „  ƒ Z e j e d ƒ d „  ƒ Z	 e j e d ƒ d „  ƒ Z
 d „  Z RS(   c   
      K   sÉ   | d  k r i  } n  | d  k	 r= t j ƒ  } t j | ƒ n  |  j | �  \ } } t | ƒ } | j ƒ  x* | j ƒ  D] \ } }	 t | | |	 ƒ qu W| j	 ƒ  | j
 ƒ  | d  k	 rÅ t j | ƒ n  | S(   N(   t   Nonet   ost   getcwdt   chdirt   create_distR   t   initialize_optionst   itemst   setattrt   ensure_finalizedt   run(
   t   selft   metadatat   cwdt   optionst   old_dirt   pkg_infot   distt   cmdt   namet   value(    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_check.pyt   _run   s    	


c         C   s  |  j  ƒ  } |  j | j d ƒ i d d 6d d 6d d 6d d 6d d 6} |  j  | ƒ } |  j | j d ƒ |  j t |  j  i  i d	 d
 6� |  j  | d
 d	 ƒ} |  j | j d ƒ i d d 6d d 6d d 6d d 6d d 6d d 6d d 6} |  j  | ƒ } |  j | j d ƒ d  S(   Ni   t   xxxt   urlt   authort   author_emailR   t   versioni    i   t   strictu   xxxu   Ã‰ricu   nameu   Something about esszet ÃŸt   descriptionu   More things about esszet ÃŸt   long_description(   R   t   assertEqualt	   _warningst   assertRaisesR   (   R   R   R   (    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_check.pyt   test_check_metadata*   s"     
s   won't test without docutilsc         C   sx   |  j  ƒ  \ } } t | ƒ } d } | j | ƒ } |  j t | ƒ d ƒ d } | j | ƒ } |  j t | ƒ d ƒ d  S(   Ns   title
===

testi   s   title
=====

testi    (   R
   R   t   _check_rst_dataR#   t   len(   R   R   R   R   t   broken_restt   msgst   rest(    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_check.pyt   test_check_documentK   s    c         C   s  d } |  j  d | ƒ \ } } t | ƒ } | j ƒ  |  j | j d ƒ i d d 6d d 6d d 6d d 6d d	 6| d 6} |  j t |  j | i d d
 6d d 6� d | d <|  j | d
 d d d ƒ} |  j | j d ƒ d | d <|  j | d t d
 d d d ƒ} |  j | j d ƒ d  S(   Ns   title
===

testR"   i   R   R   R   R   R   R   R    t   restructuredtextu   title
=====

test ÃŸi    s)   title
=====

.. include:: includetest.rstR   (	   R
   R   t   check_restructuredtextR#   R$   R%   R   R   t   HERE(   R   R)   R   R   R   R   (    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_check.pyt   test_check_restructuredtextZ   s"    



!c         C   sÝ   g  } | j  t j d ƒ ƒ | j  t j d ƒ ƒ x¤ | D]œ } |  j d | ƒ \ } } t | ƒ } | j ƒ  | j | ƒ } t d  k	 r¡ |  j	 t
 | ƒ d ƒ q9 |  j	 t
 | ƒ d ƒ |  j	 t | d d ƒ d ƒ q9 Wd  S(   Ns}               Here's some code:

            .. code:: python

                def foo():
                    pass
            sƒ               Here's some code:

            .. code-block:: python

                def foo():
                    pass
            R"   i    i   s0   Cannot analyze code. Pygments package not found.(   t   appendt   textwrapt   dedentR
   R   R.   R'   t   pygmentsR   R#   R(   t   str(   R   t   example_rst_docst   rest_with_codeR   R   R   R*   (    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_check.pyt1   test_check_restructuredtext_with_syntax_highlightu   s     


c         C   s?   i d d 6d d 6} |  j  t |  j i  i d d 6d d 6� d  S(   NR   R   R   i   R    R-   (   R%   R   R   (   R   R   (    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_check.pyt   test_check_all™   s    N(   t   __name__t
   __module__R   R   R&   t   unittestt
   skipUnlessR   R,   R0   R8   R9   (    (    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_check.pyR      s   	!$c           C   s   t  j t ƒ S(   N(   R<   t	   makeSuiteR   (    (    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_check.pyt
   test_suite    s    t   __main__(   t   __doc__R   R2   R<   t   test.test_supportR    t   distutils.command.checkR   R   t   distutils.testsR   t   distutils.errorsR   R4   t   ImportErrorR   t   patht   dirnamet   __file__R/   t   LoggingSilencert   TempdirManagert   TestCaseR   R?   R:   (    (    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_check.pyt   <module>   s$   
	‰	