ó
Š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 Z d  d l m Z d  d l	 Z	 d e	 j
 f d „  ƒ  YZ d „  Z e d k r¨ e ƒ  n  d S(   iÿÿÿÿN(   t   test_supportt   CompileallTestsc           B   sb   e  Z d  „  Z d „  Z d „  Z e j e e d ƒ d ƒ d „  ƒ Z	 d „  Z
 d „  Z d „  Z RS(	   c         C   s¿   t  j ƒ  |  _ t j j |  j d ƒ |  _ |  j t r< d n d |  _ t	 |  j d ƒ � } | j
 d ƒ Wd  QXt j j |  j d ƒ |  _ |  j t r› d n d |  _ t j |  j |  j ƒ d  S(   Ns   _test.pyt   ct   ot   ws   x = 123
s	   _test2.py(   t   tempfilet   mkdtempt	   directoryt   ost   patht   joint   source_patht	   __debug__t   bc_patht   opent   writet   source_path2t   bc_path2t   shutilt   copyfile(   t   selft   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_compileall.pyt   setUp   s    c         C   s   t  j |  j ƒ d  S(   N(   R   t   rmtreeR   (   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_compileall.pyt   tearDown   s    c         C   sj   t  |  j d ƒ � } | j d ƒ } Wd  QXt t j |  j ƒ j ƒ } t j	 d t
 j ƒ  | ƒ } | | f S(   Nt   rbi   s   <4sl(   R   R   t   readt   intR   t   statR   t   st_mtimet   structt   packt   impt	   get_magic(   R   R   t   datat   mtimet   compare(    (    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_compileall.pyR"      s
    R   s   test needs os.stat()c         C   sÏ   t  j |  j ƒ |  j |  j ƒ  Œ  t |  j d ƒ � } | j ƒ  t | ƒ } Wd QXt |  j d ƒ �! } | j	 | ƒ | j	 | ƒ Wd QX|  j
 |  j ƒ  Œ  t j |  j d t d t ƒ|  j |  j ƒ  Œ  d S(   sO   Check that compileall recreates bytecode when the new metadata is
        used.R   Nt   wbt   forcet   quiet(   t
   py_compilet   compileR   t   assertEqualR"   R   R   R   t   lenR   t   assertNotEqualt
   compileallt   compile_dirR   t   Falset   Truet
   assertTrue(   R   t   metadataR   t   bc(    (    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_compileall.pyt   recreation_check"   s    c         C   s&   |  j  t j d t j ƒ  d ƒ ƒ d  S(   Ns   <4sli   (   R4   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_compileall.pyt
   test_mtime1   s    c         C   s   |  j  d ƒ d  S(   Ns       (   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_compileall.pyt   test_magic_number5   s    c         C   s  x5 |  j  |  j f D]! } y t j | ƒ Wq q Xq Wt j |  j d t d t ƒ|  j	 t j
 j |  j  ƒ o‚ t j
 j |  j ƒ ƒ t j |  j  ƒ t j |  j d t d t ƒ|  j	 t j
 j |  j  ƒ oß t j
 j |  j ƒ ƒ t j |  j  ƒ t j |  j ƒ d  S(   NR&   R'   (   R   R   R   t   unlinkR-   t   compile_fileR   R/   R0   R1   R	   t   isfileR.   R   (   R   t   fn(    (    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_compileall.pyt   test_compile_files9   s    (   t   __name__t
   __module__R   R   R"   t   unittestt
   skipUnlesst   hasattrR   R4   R5   R6   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_compileall.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_compileall.pyt	   test_mainJ   s    t   __main__(   R-   R    R   R(   R   R   R   t   testR    R>   t   TestCaseR   RB   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_compileall.pyt   <module>   s   >	