ó
ŒwÛjc           @   s  d  d l  m Z e j d d ƒ y d  d l Z Wn e k
 rI d Z n Xd  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 m Z m Z e d Z d Z d
 e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d „  Z e d k re ƒ  n  d S(   iÿÿÿÿ(   t   test_supportt   extralargefiles>   test requires loads of disk-space bytes and a long time to runN(   t   TemporaryFile(   t   TESTFNt   run_unittestt   2i   i<   t   TestsWithSourceFilec           B   sG   e  Z d  „  Z d „  Z d „  Z e j e d ƒ d „  ƒ Z d „  Z	 RS(   c         C   sU   d „  t  d ƒ Dƒ } d j | ƒ |  _ t t d ƒ } | j |  j ƒ | j ƒ  d  S(   Nc         s   s   |  ] } d  | Vq d S(   s   Test of zipfile line %d.N(    (   t   .0t   i(    (    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_zipfile64.pys	   <genexpr>&   s    i@B s   
t   wb(   t   xranget   joint   datat   openR   t   writet   close(   t   selft   line_gent   fp(    (    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_zipfile64.pyt   setUp"   s
    c         C   sf  t  j | d | d t ƒ} d d
 t |  j ƒ } t j ƒ  t } xt t | ƒ D]f } | j d | |  j ƒ | t j ƒ  k rO t j ƒ  t } t	 j
 d | | f IJt	 j
 j ƒ  qO qO W| j ƒ  t  j | d | ƒ } x} t | ƒ D]o } |  j | j d | ƒ |  j ƒ | t j ƒ  k rå t j ƒ  t } t	 j
 d	 | | f IJt	 j
 j ƒ  qå qå W| j ƒ  d  S(   Nt   wt
   allowZip64i   i   i   s   testfn%ds/     zipTest still writing %d of %d, be patient...t   rs/     zipTest still reading %d of %d, be patient...i   @(   t   zipfilet   ZipFilet   Truet   lenR   t   timet   _PRINT_WORKING_MSG_INTERVALt   ranget   writestrt   syst
   __stdout__t   flushR   t   assertEqualt   read(   R   t   ft   compressiont   zipfpt	   filecountt	   next_timet   num(    (    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_zipfile64.pyt   zipTest.   s,    
 c         C   sL   t  ƒ  �* } |  j | t j ƒ |  j | j ƒ Wd  QX|  j t t j ƒ d  S(   N(   R   R*   R   t
   ZIP_STOREDt   assertFalset   closedt   TESTFN2(   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_zipfile64.pyt
   testStoredO   s    s   requires zlibc         C   sL   t  ƒ  �* } |  j | t j ƒ |  j | j ƒ Wd  QX|  j t t j ƒ d  S(   N(   R   R*   R   t   ZIP_DEFLATEDR,   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_zipfile64.pyt   testDeflatedW   s    c         C   s=   x6 t  t f D]( } t j j | ƒ r t j | ƒ q q Wd  S(   N(   R   R.   t   ost   patht   existst   remove(   R   t   fname(    (    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_zipfile64.pyt   tearDown`   s    (
   t   __name__t
   __module__R   R*   R/   t   unittestt
   skipUnlesst   zlibR1   R7   (    (    (    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_zipfile64.pyR   !   s
   		!		t
   OtherTestsc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   s
  t  j t d d d t ƒ} d | _ d d } x4 t | ƒ D]& } | j d	 | d
 | d d ƒ q; W|  j t | j	 ƒ  ƒ | ƒ | j
 ƒ  t  j t d d ƒ} |  j t | j	 ƒ  ƒ | ƒ x= t | ƒ D]/ } |  j | j d	 | ƒ d
 | d d ƒ qÉ W| j
 ƒ  d  S(   Nt   modeR   R   id   i   i   i   i   s   foo%08ds   %di9   R   i   i   (   R   R   R   R   t   debugR
   R   R"   R   t   namelistR   R#   (   R   t   zipft   numfilesR   t   zipf2(    (    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_zipfile64.pyt   testMoreThan64kFilesg   s    	
$
-c         C   sˆ  t  j t d d d t ƒ} d | _ d } x4 t | ƒ D]& } | j d | d | d	 d
 ƒ q7 W|  j t | j	 ƒ  ƒ | ƒ |  j
 t  j ƒ � | j d | d ƒ Wd  QX|  j t | j	 ƒ  ƒ | ƒ | j ƒ  t  j t d d d t ƒ} d | _ |  j t | j	 ƒ  ƒ | ƒ |  j
 t  j ƒ � | j d | d ƒ Wd  QX|  j t | j	 ƒ  ƒ | ƒ | j ƒ  t  j t d d d t ƒ} d | _ |  j t | j	 ƒ  ƒ | ƒ d } x7 t | | ƒ D]& } | j d | d | d	 d
 ƒ q¹W|  j t | j	 ƒ  ƒ | ƒ | j ƒ  t  j t d d ƒ} |  j t | j	 ƒ  ƒ | ƒ x= t | ƒ D]/ } |  j | j d | ƒ d | d	 d
 ƒ qGW| j ƒ  d  S(   NR>   R   R   id   i   i   s   foo%08ds   %di   i9   t    t   ai   R   i   iÿÿ  i   i   i € (   R   R   R   t   FalseR?   R   R   R"   R   R@   t   assertRaisest   LargeZipFileR   R   R#   (   R   RA   RB   R   t	   numfiles2RC   (    (    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_zipfile64.pyt   testMoreThan64kFilesAppendx   s<    	$
	
	$
-c         C   s   t  j t ƒ t  j t ƒ d  S(   N(   R    t   unlinkR   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_zipfile64.pyR7   ›   s    (   R8   R9   RD   RK   R7   (    (    (    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_zipfile64.pyR=   f   s   		#c           C   s   t  t t ƒ d  S(   N(   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_zipfile64.pyt	   test_mainŸ   s    t   __main__i,  (   t   testR    t   requiresR<   t   ImportErrort   NoneR   R2   R:   R   R   t   tempfileR   t   test.test_supportR   R   R.   R   t   TestCaseR   R=   RM   R8   (    (    (    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_zipfile64.pyt   <module>   s&   
$
E9	