ó
‹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 m Z d „  Z d „  Z d e j	 f d „  ƒ  YZ
 d „  Z e d k r– e ƒ  n  d S(	   iÿÿÿÿN(   t   test_supportc         C   s…   t  j |  ƒ } xb | D]Z } t  j j |  | ƒ } t  j j | ƒ rc t  j j | ƒ rc t | ƒ q t  j | ƒ q Wt  j |  ƒ d  S(   N(	   t   ost   listdirt   patht   joint   isdirt   islinkt   cleanoutt   removet   rmdir(   t   roott   namest   namet   fullname(    (    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_pkg.pyR      s    %c         C   s    d |  k r |  j  d ƒ n  |  S(   Nt   __builtins__(   R   (   t   lst(    (    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_pkg.pyt   fixdir   s    t   Testc           B   s’   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z e j e j j d k d ƒ d „  ƒ Z RS(   c         C   s(   d  |  _ d  |  _ t t j ƒ |  _ d  S(   N(   t   NoneR
   t   pkgnamet   listt   sysR   t   syspath(   t   self(    (    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_pkg.pyt   setUp/   s    		c         C   s…   |  j  t j (|  j r& t |  j ƒ n  |  j r� g  t j D]$ } |  j | j d ƒ k r9 | ^ q9 } x | D] } t j | =qj Wn  d  S(   Nt   .(   R   R   R   R
   R   R   t   modulest   split(   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_pkg.pyt   tearDown4   s    		$c         B   s!   e  j | ƒ e ƒ  i |  d 6Ud  S(   NR   (   t   textwrapt   dedentt   globals(   R   t   code(    (    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_pkg.pyt   run_code@   s    c   	      C   s  t  j ƒ  } t j j d | ƒ t j j | ƒ sA t j | ƒ n  x´ | D]¬ \ } } | j ƒ  } | } x# | D] } t j j	 | | ƒ } qm W| d  k r¨ t j | ƒ qH t | d ƒ } | j | ƒ | rê | d d k rê | j d ƒ n  | j ƒ  qH W| |  _ | d d |  _ d  S(   Ni    t   wiÿÿÿÿs   
(   t   tempfilet   mkdtempR   R   t   insertR   R   t   mkdirR   R   R   t   opent   writet   closeR
   R   (	   R   t   descrR
   R   t   contentst   compsR   t   ct   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_pkg.pyt   mkhierC   s$    	c         C   s:   d d t j d d f g } |  j | ƒ d d  l } d  S(   Nt   t1s   t1 __init__t   pyt    iÿÿÿÿ(   R0   N(   R   R   t   extsepR/   R0   (   R   t   hierR0   (    (    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_pkg.pyt   test_1Y   s    c         C   sÚ  d d t j d d f d d t j d d f d d	 t j d d
 f g } |  j | ƒ d d  l } d d  l } |  j | j d ƒ |  j | j j d ƒ |  j | j j	 j d ƒ d } |  j
 | ƒ d d l m } d d l m	 } d d l m } |  j | j d ƒ |  j | j d ƒ |  j | j	 j d ƒ x5 d d d d g D]! } |  j t ƒ  d d | ƒ qDWd d  l } d d  l } |  j | j d ƒ |  j | j j d ƒ |  j | j j	 j d ƒ d } |  j
 | ƒ d  S(   Nt   t2s   t2 __init__R1   s   'doc for t2's   t2 subs   t2 sub __init__R2   s   t2 sub subsubs   t2 sub subsub __init__s   spam = 1iÿÿÿÿs   t2.subs   t2.sub.subsubs{   
            import t2
            from t2 import *
            self.assertEqual(dir(), ['self', 'sub', 't2'])
            (   t   sub(   t   subsub(   t   spamR9   R7   R8   R   s   Failed to import %ss_   
            from t2 import *
            self.assertEqual(dir(), ['self', 'sub'])
            (   R6   N(   s   t2 subN(   s   t2 sub subsubN(   R   R   R3   R/   t   t2.subt   t2.sub.subsubt   assertEqualt   __name__R7   R8   R!   R6   R9   t
   assertTruet   locals(   R   R4   R6   t   sR7   R8   R9   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_pkg.pyt   test_2^   s:    c         C   sª   d d t j d d f d d t j d d f d d t j d d	 f g } |  j | ƒ d
 d  l } |  j | j d ƒ |  j | j j d ƒ |  j | j j j d ƒ d  S(   Nt   t3s   t3 __init__R1   R2   s   t3 subs   t3 sub __init__s   t3 sub subsubs   t3 sub subsub __init__s   spam = 1iÿÿÿÿs   t3.subs   t3.sub.subsub(   RB   N(   s   t3 subN(   s   t3 sub subsubN(	   R   R   R3   R/   t   t3.sub.subsubR<   R=   R7   R8   (   R   R4   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_pkg.pyt   test_3�   s    c      
   C   s‰   d d d t j d d f d d d
 t j d d f d t j d d f d d t j d d f g	 } |  j | ƒ d } |  j | ƒ d  S(   Ns   t4.pys)   raise RuntimeError('Shouldnt load t4.py')t   t4s   t4 __init__R1   R2   s	   t4 sub.pys*   raise RuntimeError('Shouldnt load sub.py')s   t4 subs   t4 sub __init__s   t4 sub subsubs-   raise RuntimeError('Shouldnt load subsub.py')s   t4 sub subsub __init__s   spam = 1s[   
            from t4.sub.subsub import *
            self.assertEqual(spam, 1)
            (   s   t4.pys)   raise RuntimeError('Shouldnt load t4.py')(   RE   N(   s	   t4 sub.pys*   raise RuntimeError('Shouldnt load sub.py')(   s   t4 subN(   s   t4 sub subsubN(   R   R   R3   R/   R!   (   R   R4   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_pkg.pyt   test_4�   s    c      
   C   s  d d t j d d f d t j d d f d t j d d f g } |  j | ƒ d	 d  l } d
 } |  j | ƒ d	 d  l } |  j t t | ƒ ƒ d d d d d d d d g ƒ |  j t t | j	 ƒ ƒ d d d d d g ƒ |  j t t | j
 ƒ ƒ d d d d d g ƒ d  S(   Nt   t5s   t5 __init__R1   s   import t5.foos	   t5 strings   spam = 1s   t5 foos-   from . import string; assert string.spam == 1iÿÿÿÿso   
            from t5 import *
            self.assertEqual(dir(), ['foo', 'self', 'string', 't5'])
            t   __doc__t   __file__R=   t   __package__t   __path__t   foot   stringR9   (   RG   N(   R   R   R3   R/   RG   R!   R<   R   t   dirRL   RM   (   R   R4   RG   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_pkg.pyt   test_5²   s&    	
c         C   s·   d d t j d d f d t j d d f d t j d d f d t j d d f g } |  j | ƒ d	 d  l } |  j t t | ƒ ƒ d
 d d d d d g ƒ d } |  j | ƒ d  S(   Nt   t6s   t6 __init__R1   s!   __all__ = ['spam', 'ham', 'eggs']s   t6 spamR2   s   t6 hams   t6 eggsiÿÿÿÿt   __all__RH   RI   R=   RJ   RK   st  
            import t6
            from t6 import *
            self.assertEqual(fixdir(dir(t6)),
                             ['__all__', '__doc__', '__file__',
                              '__name__', '__package__', '__path__',
                              'eggs', 'ham', 'spam'])
            self.assertEqual(dir(), ['eggs', 'ham', 'self', 'spam', 't6'])
            (   RP   N(	   R   R   R3   R/   RP   R<   R   RN   R!   (   R   R4   RP   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_pkg.pyt   test_6Î   s    		c   	   
   C   sì  d d t j d d f d t j d d f d t j d d f d d t j d d f d t j d d	 f d d t j d d f g	 } |  j | ƒ d \ } } } d d  l } |  j t t | ƒ ƒ d d d d d g ƒ |  j | ƒ d d l m	 } |  j t t | ƒ ƒ d d d d d g ƒ |  j | ƒ |  j | ƒ d d l
 m } |  j t t | ƒ ƒ d d d d d d g ƒ |  j | ƒ |  j | ƒ |  j | ƒ d d l m } |  j | d ƒ |  j | ƒ |  j | ƒ |  j | ƒ d  S(   Nt   t7R1   R2   s   t7 __init__s   t7 subs*   raise RuntimeError('Shouldnt load sub.py')s   t7 sub __init__s   t7 sub s-   raise RuntimeError('Shouldnt load subsub.py')s   t7 sub subsubs   t7 sub subsub __init__s   spam = 1iÿÿÿÿRH   RI   R=   RJ   RK   (   R7   (   R8   R9   (   R9   i   (   RS   N(   s   t7 subN(   s   t7 sub subsubN(   NNN(   R   R   R3   R/   RS   R<   R   RN   t   assertFalseR7   t   t7.subR8   t   t7.sub.subsubR9   (	   R   R4   RS   R7   R8   t   tast   subpart	   subsubsubt   ham(    (    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_pkg.pyt   test_7è   sJ    			i   s)   Docstrings are omitted with -O2 and abovec         C   sM   d d t j d d f g } |  j | ƒ d d  l } |  j | j d ƒ d  S(   Nt   t8s   t8 __init__R1   s   'doc for t8'iÿÿÿÿs
   doc for t8(   R\   N(   R   R   R3   R/   R\   R<   RH   (   R   R4   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_pkg.pyt   test_8  s
    (   R=   t
   __module__R   R   R!   R/   R5   RA   RD   RF   RO   RR   R[   t   unittestt   skipIfR   t   flagst   optimizeR]   (    (    (    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_pkg.pyR   -   s   						/					+c           C   s   t  j t ƒ d  S(   N(   R    t   run_unittestR=   (    (    (    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_pkg.pyt	   test_main  s    t   __main__(   R   R   R#   R   R_   t   testR    R   R   t   TestCaseR   Rd   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_pkg.pyt   <module>   s   	
	ò	