ó
‹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 e j d d e	 ƒZ
 d  d l m Z m Z m Z d  d l
 m Z d „  Z d e
 j j f d	 „  ƒ  YZ d
 e j f d „  ƒ  YZ d „  Z e d k rö e ƒ  n  d S(   iÿÿÿÿN(   t   test_supportt   hotshott
   deprecated(   t   ENTERt   EXITt   LINE(   t   statsc         C   s.   |  r& t  j j t  j j |  ƒ ƒ d S|  Sd  S(   Ni    (   t   ost   patht   splitextt   basename(   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_hotshot.pyt   shortfilename   s     t   UnlinkingLogReaderc           B   s#   e  Z d  Z d „  Z d d „ Z RS(   sM   Extend the LogReader so the log file is unlinked when we're
    done with it.c         C   s#   | |  _  t j j j |  | ƒ d  S(   N(   t   _UnlinkingLogReader__logfnR   t   logt	   LogReadert   __init__(   t   selft   logfn(    (    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_hotshot.pyR      s    	c         C   sL   y t  j j j |  ƒ SWn. t k
 rG |  j ƒ  t j |  j ƒ ‚  n Xd  S(   N(	   R   R   R   t   nextt   StopIterationt   closeR   t   unlinkR   (   R   t   index(    (    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_hotshot.pyR   "   s    
N(   t   __name__t
   __module__t   __doc__R   t   NoneR   (    (    (    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_hotshot.pyR      s   	t   HotShotTestCasec           B   s}   e  Z d  d d „ Z d „  Z d „  Z d „  Z d d „ Z d „  Z d „  Z	 d	 „  Z
 d
 „  Z d „  Z d „  Z d „  Z RS(   i    i   c         C   s"   t  j |  _ t j |  j | | ƒ S(   N(   R    t   TESTFNR   R   t   Profile(   R   t
   lineeventst   linetimings(    (    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_hotshot.pyt   new_profiler,   s    c         C   s   t  |  j ƒ 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_hotshot.pyt   get_logreader0   s    c         C   s[   g  } xN |  j  ƒ  D]@ } | \ } \ } } } } | j | t | ƒ | | f f ƒ q W| S(   N(   R#   t   appendR   (   R   t   Lt   eventt   whatt   filenamet   linenot   funcnamet   tdelta(    (    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_hotshot.pyt   get_events_wotime3   s
    &c         C   sH   |  j  ƒ  } | | k rD |  j d t j | ƒ t j | ƒ f ƒ n  d  S(   Ns6   events did not match expectation; got:
%s
expected:
%s(   R,   t   failt   pprintt   pformat(   R   t   expectedt   events(    (    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_hotshot.pyt   check_events:   s
    c         C   s~   | d  k r |  j ƒ  } n  |  j | j j ƒ | j | ƒ |  j | j j ƒ | j ƒ  |  j | j j ƒ |  j | ƒ d  S(   N(   R   R"   t
   assertTruet   _proft   closedt   runcallR   R2   (   R   t   callableR1   t   profiler(    (    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_hotshot.pyt   run_testA   s    
c         C   sl   d „  } |  j  ƒ  } | j | | ƒ | j ƒ  |  j ƒ  } | j } t | ƒ |  j | d d g k ƒ d  S(   Nc         S   s   |  j  d d ƒ d  S(   Ns   test-keys
   test-value(   t   addinfo(   t   p(    (    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_hotshot.pyt   fL   s    s   test-keys
   test-value(   R"   R6   R   R#   t   _infot   listR3   (   R   R<   R8   R   t   info(    (    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_hotshot.pyt   test_addinfoK   s    	
	
c      
      sã   d „  ‰  ‡  f d †  } ˆ  j  j } | j  j } t d | d f f t d | d d f f t d | d f f t d | d d f f t d | d d f f t d | d f f t d | d f f g } |  j | | |  j d d ƒ ƒ d  S(	   Nc          S   s   d }  d } d  S(   Ni   i   (    (   t   yt   x(    (    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_hotshot.pyR<   W   s    c              s   ˆ  ƒ  d  S(   N(    (    (   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_hotshot.pyt   gZ   s    t   test_hotshotRC   i   R<   i   R    (   t	   func_codet   co_firstlinenoR   R   R   R9   R"   (   R   RC   t   f_linenot   g_linenoR1   (    (   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_hotshot.pyt   test_line_numbersV   s    	c         C   s>   |  j  ƒ  } | j ƒ  | j ƒ  | j ƒ  t j |  j ƒ d  S(   N(   R"   t   startt   stopR   R   R   R   (   R   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_hotshot.pyt   test_start_stoph   s
    


c         C   s¥   d d  l  } d d  l } | j } t j j } z? d | _ |  j t | t j	 ƒ | ` |  j t | t j	 ƒ Wd  | | _ | j j
 t j	 ƒ r  | j t j	 ƒ n  Xd  S(   Niÿÿÿÿt   abc(   t   sysR   R   R   t   _hotshott   coveraget   assertRaisest   RuntimeErrorR    R   t   existst   remove(   R   RN   R   t	   orig_pathRP   (    (    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_hotshot.pyt   test_bad_sys_pathr   s    			c         C   sK   t  j ƒ  } z# |  j t t f t j | j ƒ Wd  | j ƒ  Xt	 j
 ƒ  d  S(   N(   t   tempfilet   NamedTemporaryFileRQ   t   IOErrort   EOFErrorRO   t	   logreadert   nameR   t   gct   collect(   R   t	   emptyfile(    (    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_hotshot.pyt   test_logreader_eof_errorƒ   s    c         C   sW   d „  } |  j  ƒ  } | | ƒ | j ƒ  | j ƒ  t j |  j ƒ t j |  j ƒ d  S(   Nc         S   s   |  j  ƒ  d  S(   N(   RJ   (   t   prof(    (    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_hotshot.pyRJ   �   s    (   R"   RK   R   R   t   loadR   R   R   (   R   RJ   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_hotshot.pyt   test_load_statsŒ   s    	


c         C   s-   |  j  ƒ  } |  j t | j d d d ƒ d  S(   Nt   Aiëü  (   R"   RQ   t
   ValueErrorR:   (   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_hotshot.pyt   test_large_info˜   s    N(   R   R   R"   R#   R,   R2   R   R9   R@   RI   RL   RV   R`   Rc   Rf   (    (    (    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_hotshot.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_hotshot.pyt	   test_main�   s    t   __main__(   R   R.   t   unittestRW   RO   R]   t   testR    t   import_modulet   TrueR   t   hotshot.logR   R   R   R   R   R   R   R   t   TestCaseR   Rh   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_hotshot.pyt   <module>   s   	
r	