ķ
wÛjc           @   s   d  d l  Z  d  d l Z 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   Z
 e d k r e
   n  d S(   i˙˙˙˙N(   t   run_unittestt
   TestImportc           B   s>   e  Z d    Z d   Z d   Z d   Z d   Z d   Z RS(   c         O   sg   d |  _  x1 |  j  t j k r< |  j  t j t j  7_  q W|  j  d |  _ t j	 j
 |  | |  d  S(   Nt   PACKAGE_s   .foo(   t   package_namet   syst   modulest   randomt   chooset   stringt   letterst   module_namet   unittestt   TestCaset   __init__(   t   selft   argst   kw(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_pkgimport.pyR      s
    	c         C   s=   x6 |  j  |  j f D]" } | t j k r t j | =q q Wd  S(   N(   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/test/test_pkgimport.pyt   remove_modules   s    c         C   sĒ   t  j   |  _ t j j |  j  t j j |  j |  j  |  _	 t j
 |  j	  t t j j |  j	 d t j d  d  j   t j j |  j	 d t j d  |  _ d  S(   NR   t   pyt   wt   foo(   t   tempfilet   mkdtempt   test_dirR   t   patht   appendt   ost   joinR   t   package_dirt   mkdirt   opent   extsept   closet   module_path(   R   (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_pkgimport.pyt   setUp   s    $c         C   s   x9 t  j |  j  D]% } t  j t  j j |  j |   q Wt  j |  j  t  j |  j  |  j t	 j j
 |  j  d  t	 j j |  j  |  j   d  S(   Ni    (   R   t   listdirR   t   removeR   R   t   rmdirR   t   assertNotEqualR   t   countR   (   R   t   file(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_pkgimport.pyt   tearDown   s    #c         C   sm   x= d D]5 } |  j  | } t j j |  r t j |  q q Wt |  j  d  } | j |  | j   d  S(   Nt   coR   (   R!   R   R   t   existsR$   R   t   writeR    (   R   t   contentst	   extensiont   compiled_patht   f(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_pkgimport.pyt   rewrite_file&   s    c         C   s!  |  j  d  y t |  j  Wn t k
 r1 n
 Xt d  |  j |  j t j  |  j t	 t j |  j
 d   d } x, | t t  k rĨ | t j t j  7} qz W|  j  |  y t |  j  Wn t k
 r× n
 Xt d  |  j  d |  t |  j  j } |  j t | |  d  d  S(   Nt   fors   Failed to induce SyntaxErrorR   t   as   Failed to induce NameError.s   %s = 1i   (   R1   t
   __import__R
   t   SyntaxErrort   RuntimeErrort   assertNotInR   R   t   assertFalset   hasattrR   t   dirt   __builtins__R   R   R   R	   t	   NameErrorR   t   assertEqualt   getattr(   R   t   vart   module(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_pkgimport.pyt   test_package_import__semantics/   s(      	   	(   t   __name__t
   __module__R   R   R"   R)   R1   RA   (    (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_pkgimport.pyR      s   			
				c           C   s   t  t  d  S(   N(   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/test/test_pkgimport.pyt	   test_mainN   s    t   __main__(   R   R   R   R   R   R   t   test.test_supportR    R   R   RD   RB   (    (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_pkgimport.pyt   <module>   s
   HI	