
    f:                        d Z ddlm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m
Z
 ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z  ddlm!Z! ddlm"Z" ddlm#Z# ddlm$Z$ ddlm%Z% ddlm&Z& ejN                  jP                  Z( ejR                         Z*d Z+d! Z, G d" d#e      Z- G d$ d%e-      Z. ej^                  e d&       G d' d(e             Z0 G d) d*e      Z1e2d+k(  rdd,l3m4Z4  e4e5       yy)-a  Tests for detecting function memory leaks (typically the ones
implemented in C). It does so by calling a function many times and
checking whether process memory usage keeps increasing between
calls or over time.
Note that this may produce false positives (especially on Windows
for some reason).
PyPy appears to be completely unstable for this framework, probably
because of how its JIT handles memory, so tests are skipped.
    )print_functionN)LINUX)MACOS)OPENBSD)POSIX)SUNOS)WINDOWS)ProcessLookupError)super)HAS_CPU_AFFINITY)HAS_CPU_FREQ)HAS_ENVIRON)
HAS_IONICE)HAS_MEMORY_MAPS)HAS_NET_IO_COUNTERS)HAS_PROC_CPU_NUM)HAS_PROC_IO_COUNTERS)
HAS_RLIMIT)HAS_SENSORS_BATTERY)HAS_SENSORS_FANS)HAS_SENSORS_TEMPERATURES)TestMemoryLeak)create_sockets)
get_testfn)process_namespace)skip_on_access_denied)spawn_testproc)system_namespace)	terminate   c                      d } | S )zsDecorator for those Linux functions which are implemented in pure
    Python, and which we want to run faster.
    c                 B     t        j                          fd       }|S )Nc                     t         rI| j                  j                  }	 t        | j                  _         | g|i ||| j                  _        S  | g|i |S # || j                  _        w xY wN)r   	__class__times	FEW_TIMES)selfargskwargsbeforefuns       </usr/lib/python3/dist-packages/psutil/tests/test_memleaks.pywrapperz5fewtimes_if_linux.<locals>.decorator.<locals>.wrapperC   si    --2+4DNN(t5d5f5+1DNN(41$1&11 ,2DNN(s    A A0)	functoolswraps)r,   r.   s   ` r-   	decoratorz$fewtimes_if_linux.<locals>.decoratorB   s%    				2 
		2      )r1   s    r-   fewtimes_if_linuxr4   =   s    
 r2   c                   h   e Zd ZdZeZd Z e       d        Z e       d        Z	 e       d        Z
 e       d        Z ej                  e d       e       d               Z ej                  e d       e       d	               Z e       d
        Zd Zd Z ej                  e d      d        Z ej                  e d      d        Z ej                  e d       e       d               Z ej                  ed      d        Z e       d        Z e        ee      d               Z ej                  e d      d        Z ej                  e d       e       d               Z  e       d        Z! e        ee      d               Z" e       d        Z# e        ej                  e$ d      d               Z% e       d        Z& e       d        Z' ej                  e d       e       d               Z(d  Z) e       d!        Z* ej                  e+ d      d"        Z, ej                  e+ d      d#        Z- e       d$        Z. ej                  e/ d       e       d%               Z0 ej                  e1 d&       ej                  e2 d      d'               Z3 ej                  e1 d&       ej                  e2 d      d(               Z4 e        ej                  ed)      d*               Z5 ej                  e6 d      d+        Z7 ej                  e d      d,        Z8y-).TestProcessObjectLeaksz$Test leaks of Process class methods.c                 l    t        d       }|j                  | |j                  |j                  z          y r$   )r   test_class_coveragegetterssettersr(   nss     r-   test_coveragez$TestProcessObjectLeaks.test_coverage^   s)    t$
tRZZ"**%<=r2   c                 N    | j                  | j                  j                         y r$   )executeprocnamer(   s    r-   	test_namez TestProcessObjectLeaks.test_nameb       TYY^^$r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   cmdlinerB   s    r-   test_cmdlinez#TestProcessObjectLeaks.test_cmdlinef       TYY&&'r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   exerB   s    r-   test_exezTestProcessObjectLeaks.test_exej       TYY]]#r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   ppidrB   s    r-   	test_ppidz TestProcessObjectLeaks.test_ppidn   rD   r2   z
POSIX onlyc                 N    | j                  | j                  j                         y r$   )r?   r@   uidsrB   s    r-   	test_uidsz TestProcessObjectLeaks.test_uidsr        	TYY^^$r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   gidsrB   s    r-   	test_gidsz TestProcessObjectLeaks.test_gidsw   rS   r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   statusrB   s    r-   test_statusz"TestProcessObjectLeaks.test_status|       TYY%%&r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   nicerB   s    r-   	test_nicez TestProcessObjectLeaks.test_nice   s    TYY^^$r2   c                 Z     t         j                          j                   fd       y )Nc                  :    j                   j                         S r$   )r@   r\   )nicenessr(   s   r-   <lambda>z6TestProcessObjectLeaks.test_nice_set.<locals>.<lambda>   s    TYY^^H5 r2   )thisprocr\   r?   )r(   r`   s   `@r-   test_nice_setz$TestProcessObjectLeaks.test_nice_set   s    ==?56r2   not supportedc                 N    | j                  | j                  j                         y r$   )r?   r@   ionicerB   s    r-   test_ionicez"TestProcessObjectLeaks.test_ionice   rZ   r2   c                 ,    t         r*t        j                          j                   fd       y  j                   fd       t	        j
                  t        j                  t        j                         dd      } j                  t        |       y )Nc                  :     j                   j                        S r$   )r@   rf   )r(   values   r-   ra   z8TestProcessObjectLeaks.test_ionice_set.<locals>.<lambda>   s    !1!1%!8 r2   c                  V     j                   j                  t        j                        S r$   )r@   rf   psutilIOPRIO_CLASS_NONErB   s   r-   ra   z8TestProcessObjectLeaks.test_ionice_set.<locals>.<lambda>   s    !1!1&2J2J!K r2   r   )r	   rb   rf   r?   r/   partialcextproc_ioprio_setosgetpidexecute_w_excOSError)r(   r,   rj   s   ` @r-   test_ionice_setz&TestProcessObjectLeaks.test_ionice_set   s^    OO%ELL89LLKL##D$8$8"))+r1MCw,r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   io_countersrB   s    r-   test_io_countersz'TestProcessObjectLeaks.test_io_counters        	TYY**+r2   zworthless on POSIXc                     t        j                         j                          | j                  | j                  j                         y r$   )rl   Processusernamer?   r@   rB   s    r-   test_usernamez$TestProcessObjectLeaks.test_username   s-     	!!#TYY''(r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   create_timerB   s    r-   test_create_timez'TestProcessObjectLeaks.test_create_time       TYY**+r2   )only_ifc                 N    | j                  | j                  j                         y r$   )r?   r@   num_threadsrB   s    r-   test_num_threadsz'TestProcessObjectLeaks.test_num_threads   rz   r2   WINDOWS onlyc                 N    | j                  | j                  j                         y r$   )r?   r@   num_handlesrB   s    r-   test_num_handlesz'TestProcessObjectLeaks.test_num_handles   r   r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   num_fdsrB   s    r-   test_num_fdsz#TestProcessObjectLeaks.test_num_fds        	TYY&&'r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   num_ctx_switchesrB   s    r-   test_num_ctx_switchesz,TestProcessObjectLeaks.test_num_ctx_switches       TYY//0r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   threadsrB   s    r-   test_threadsz#TestProcessObjectLeaks.test_threads   r   r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   	cpu_timesrB   s    r-   test_cpu_timesz%TestProcessObjectLeaks.test_cpu_times   s    TYY(()r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   cpu_numrB   s    r-   test_cpu_numz#TestProcessObjectLeaks.test_cpu_num   r   r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   memory_inforB   s    r-   test_memory_infoz'TestProcessObjectLeaks.test_memory_info   r   r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   memory_full_inforB   s    r-   test_memory_full_infoz,TestProcessObjectLeaks.test_memory_full_info   r   r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   terminalrB   s    r-   test_terminalz$TestProcessObjectLeaks.test_terminal   s     	TYY''(r2   c                     t         rt        n| j                  }| j                  | j                  j
                  |       y )Nr&   )r   r'   r&   r?   r@   resumer(   r&   s     r-   test_resumez"TestProcessObjectLeaks.test_resume   s)    "	

TYY%%U3r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   cwdrB   s    r-   test_cwdzTestProcessObjectLeaks.test_cwd   rL   r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   cpu_affinityrB   s    r-   test_cpu_affinityz(TestProcessObjectLeaks.test_cpu_affinity   s    TYY++,r2   c                      t         j                          j                   fd        j                  t         fd       y )Nc                  :    j                   j                         S r$   r@   r   )affinityr(   s   r-   ra   z>TestProcessObjectLeaks.test_cpu_affinity_set.<locals>.<lambda>   s    TYY33H= r2   c                  <     j                   j                  dg      S Nrn   r   rB   s   r-   ra   z>TestProcessObjectLeaks.test_cpu_affinity_set.<locals>.<lambda>   s    tyy/E/Erd/K r2   )rb   r   r?   rt   
ValueError)r(   r   s   `@r-   test_cpu_affinity_setz,TestProcessObjectLeaks.test_cpu_affinity_set   s/    ((*=>:'KLr2   c                     t        t               d      5  | j                  | j                  j                         d d d        y # 1 sw Y   y xY w)Nw)openr   r?   r@   
open_filesrB   s    r-   test_open_filesz&TestProcessObjectLeaks.test_open_files   s9    *,$ 	/LL--.	/ 	/ 	/s   &AAc                 N    | j                  | j                  j                         y r$   )r?   r@   memory_mapsrB   s    r-   test_memory_mapsz'TestProcessObjectLeaks.test_memory_maps   rz   r2   z
LINUX onlyc                 .      j                   fd       y )Nc                  V     j                   j                  t        j                        S r$   r@   rlimitrl   RLIMIT_NOFILErB   s   r-   ra   z4TestProcessObjectLeaks.test_rlimit.<locals>.<lambda>   s    TYY--f.B.BC r2   r?   rB   s   `r-   test_rlimitz"TestProcessObjectLeaks.test_rlimit   s     	CDr2   c                      t         j                  t        j                         j	                   fd        j                  t        t        f fd       y )Nc                  X    j                   j                  t        j                         S r$   r   )limitr(   s   r-   ra   z8TestProcessObjectLeaks.test_rlimit_set.<locals>.<lambda>   s    TYY--f.B.BEJ r2   c                  :     j                   j                  d      S r   )r@   r   rB   s   r-   ra   z8TestProcessObjectLeaks.test_rlimit_set.<locals>.<lambda>   s    $)):J:J2:N r2   )rb   r   rl   r   r?   rt   ru   r   )r(   r   s   `@r-   test_rlimit_setz&TestProcessObjectLeaks.test_rlimit_set   s<      4 45JKGZ02NOr2   zworthless on WINDOWSc                      t               5  t        rdnd j                   fd       d d d        y # 1 sw Y   y xY w)Ninetallc                  :    j                   j                         S r$   )r@   connections)kindr(   s   r-   ra   z9TestProcessObjectLeaks.test_connections.<locals>.<lambda>  s    !6!6t!< r2   )r   r   r?   )r(   r   s   `@r-   test_connectionsz'TestProcessObjectLeaks.test_connections   s6      	>"6DLL<=	> 	> 	>s    6?c                 N    | j                  | j                  j                         y r$   )r?   r@   environrB   s    r-   test_environz#TestProcessObjectLeaks.test_environ  rH   r2   c                 (    | j                  d        y )Nc                  P    t         j                  t        j                               S r$   )rp   	proc_inforr   rs   r3   r2   r-   ra   z7TestProcessObjectLeaks.test_proc_info.<locals>.<lambda>  s    T^^BIIK8 r2   r   rB   s    r-   test_proc_infoz%TestProcessObjectLeaks.test_proc_info	  s    89r2   N)9__name__
__module____qualname____doc__rb   r@   r=   r4   rC   rG   rK   rO   unittestskipIfr   rR   rV   rY   r]   rc   r   rg   rv   r   ry   r~   r   r   r   r   r	   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r3   r2   r-   r6   r6   Y   s   .D> % % ( ( $ $ % % X__Y-%  .% X__Y-%  .% ' '%7 X__^_5' 6' X__^_5- 6- X__--?,  @, X__U01) 2)
 , , 7+, , , X__[.1, 2, X__Y-(  .( 1 1 7+( , ( * * X__))?;( < ( , , 1 1 X__Y-)  .)4 $ $ X__))?;- <- X__))?;M <M
 / / X__(/:,  ;, X__Y-X__^_5E 6 .E X__Y-X__^_5P 6 .P
  X__W45> 6 > X___o6( 7( X__[.1: 2:r2   r6   c                   v     e Zd ZdZe fd       Ze fd       Zd Zerd Z	d Z
d Zd Zd	 Zd
 Z xZS  xZS )TestTerminatedProcessLeakszRepeat the tests above looking for leaks occurring when dealing
    with terminated processes raising NoSuchProcess exception.
    The C functions are still invoked but will follow different code
    paths. We'll check those code paths.
    c                    t               j                          t               | _        t	        j
                  | j                  j                        | _        | j                  j                          | j                  j                          y r$   )
r   
setUpClassr   subprl   r|   pidr@   killwaitclsr%   s    r-   r   z%TestTerminatedProcessLeaks.setUpClass  sM    !#>>#((,,/r2   c                 `    t               j                          t        | j                         y r$   )r   tearDownClassr   r   r   s    r-   r   z(TestTerminatedProcessLeaks.tearDownClass  s    #((r2   c                 F    	  |        y # t         j                  $ r Y y w xY wr$   )rl   NoSuchProcess)r(   r,   s     r-   callzTestTerminatedProcessLeaks.call"  s$    	E## 		s   
   c                 N    | j                  | j                  j                         y r$   )r?   r@   r   rB   s    r-   	test_killz$TestTerminatedProcessLeaks.test_kill*      LL(r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   r   rB   s    r-   test_terminatez)TestTerminatedProcessLeaks.test_terminate-  s    LL,,-r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   suspendrB   s    r-   test_suspendz'TestTerminatedProcessLeaks.test_suspend0  s    LL**+r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   r   rB   s    r-   r   z&TestTerminatedProcessLeaks.test_resume3  s    LL))*r2   c                 N    | j                  | j                  j                         y r$   )r?   r@   r   rB   s    r-   	test_waitz$TestTerminatedProcessLeaks.test_wait6  r   r2   c                 2      fd} j                  |       y )Nc                  v    	 t         j                   j                  j                        S # t        $ r Y y w xY wr$   )rp   r   r@   r   r
   rB   s   r-   r   z7TestTerminatedProcessLeaks.test_proc_info.<locals>.call;  s1    >>$))--88) s   (, 	88r   )r(   r   s   ` r-   r   z)TestTerminatedProcessLeaks.test_proc_info9  s     LLr2   )r   r   r   r   classmethodr   r   r   r	   r   r   r   r   r   r   __classcell__)r%   s   @r-   r   r     s]         	)	.	,	+	)	# r2   r   r   c                       e Zd Zd Zd Zy)TestProcessDualImplementationc                 (    | j                  d        y )Nc                  T    t         j                  t        j                         d      S )NTuse_pebrp   proc_cmdlinerr   rs   r3   r2   r-   ra   zETestProcessDualImplementation.test_cmdline_peb_true.<locals>.<lambda>G  s    T..ryy{D.I r2   r   rB   s    r-   test_cmdline_peb_truez3TestProcessDualImplementation.test_cmdline_peb_trueF  s    IJr2   c                 (    | j                  d        y )Nc                  T    t         j                  t        j                         d      S )NFr  r  r3   r2   r-   ra   zFTestProcessDualImplementation.test_cmdline_peb_false.<locals>.<lambda>J  s    T..ryy{E.J r2   r   rB   s    r-   test_cmdline_peb_falsez4TestProcessDualImplementation.test_cmdline_peb_falseI  s    JKr2   N)r   r   r   r  r	  r3   r2   r-   r   r   D  s    KLr2   r   c                   :   e Zd ZdZd Z e       d        Z e       d        Z e       d        Z e       d        Z	 e       d        Z
 e        ej                  exr  ej                         dk(  d	       ej                  e d
      d                      Z ej                  e d      d        Zd Z ej                  ed      d        Zd Zd Zd Z ej                  exr ej8                  j;                  d       d       e       d               Z e       d        Z e        ej                  e  d
      d               Z! e        ej                  exr  ejD                         dk7  d      d               Z#d Z$d Z% e        ej                  e& d
      d               Z' e        ej                  e( d
      d               Z) e        ej                  e* d
      d                Z+ e       d!        Z,d" Z-d# Z.erd$ Z/d% Z0d& Z1d' Z2d( Z3y)y))*TestModuleFunctionsLeaksz&Test leaks of psutil module functions.c                 P    t               }|j                  | |j                         y r$   )r   r8   r   r;   s     r-   r=   z&TestModuleFunctionsLeaks.test_coverageU  s    
tRVV,r2   c                 (    | j                  d        y )Nc                  .    t        j                  d      S )NTlogicalrl   	cpu_countr3   r2   r-   ra   z9TestModuleFunctionsLeaks.test_cpu_count.<locals>.<lambda>]  s    V--d; r2   r   rB   s    r-   test_cpu_countz'TestModuleFunctionsLeaks.test_cpu_count[  s    ;<r2   c                 (    | j                  d        y )Nc                  .    t        j                  d      S )NFr  r  r3   r2   r-   ra   z?TestModuleFunctionsLeaks.test_cpu_count_cores.<locals>.<lambda>a  s    V--e< r2   r   rB   s    r-   test_cpu_count_coresz-TestModuleFunctionsLeaks.test_cpu_count_cores_  s    <=r2   c                 B    | j                  t        j                         y r$   )r?   rl   r   rB   s    r-   r   z'TestModuleFunctionsLeaks.test_cpu_timesc      V%%&r2   c                 (    | j                  d        y )Nc                  .    t        j                  d      S )NT)percpu)rl   r   r3   r2   r-   ra   z=TestModuleFunctionsLeaks.test_per_cpu_times.<locals>.<lambda>i  s    V--T: r2   r   rB   s    r-   test_per_cpu_timesz+TestModuleFunctionsLeaks.test_per_cpu_timesg  s    :;r2   c                 B    | j                  t        j                         y r$   )r?   rl   	cpu_statsrB   s    r-   test_cpu_statsz'TestModuleFunctionsLeaks.test_cpu_statsk  r  r2   arm64zskipped due to #1892rd   c                 B    | j                  t        j                         y r$   )r?   rl   cpu_freqrB   s    r-   test_cpu_freqz&TestModuleFunctionsLeaks.test_cpu_freqo  s     	V__%r2   r   c                 j    t        j                          | j                  t         j                         y r$   )rl   
getloadavgr?   rB   s    r-   test_getloadavgz(TestModuleFunctionsLeaks.test_getloadavgx  s     V&&'r2   c                 B    | j                  t        j                         y r$   )r?   rl   virtual_memoryrB   s    r-   test_virtual_memoryz,TestModuleFunctionsLeaks.test_virtual_memory  s    V**+r2   z&worthless on SUNOS (uses a subprocess)c                 B    | j                  t        j                         y r$   )r?   rl   swap_memoryrB   s    r-   test_swap_memoryz)TestModuleFunctionsLeaks.test_swap_memory  s    V''(r2   c                 \    t         rt        n| j                  }| j                  d |       y )Nc                  P    t        j                  t        j                               S r$   )rl   
pid_existsrr   rs   r3   r2   r-   ra   z:TestModuleFunctionsLeaks.test_pid_exists.<locals>.<lambda>  s    V..ryy{; r2   r   r   r'   r&   r?   r   s     r-   test_pid_existsz(TestModuleFunctionsLeaks.test_pid_exists  s     "	

;5Ir2   c                 \    t         rt        n| j                  }| j                  d |       y )Nc                  ,    t        j                  d      S )N.)rl   
disk_usager3   r2   r-   ra   z:TestModuleFunctionsLeaks.test_disk_usage.<locals>.<lambda>  s    V..s3 r2   r   r0  r   s     r-   test_disk_usagez(TestModuleFunctionsLeaks.test_disk_usage  s     "	

35Ar2   c                 B    | j                  t        j                         y r$   )r?   rl   disk_partitionsrB   s    r-   test_disk_partitionsz-TestModuleFunctionsLeaks.test_disk_partitions  s    V++,r2   z/proc/diskstatsz3/proc/diskstats not available on this Linux versionc                 (    | j                  d        y )Nc                  .    t        j                  d      S NF)nowrap)rl   disk_io_countersr3   r2   r-   ra   z@TestModuleFunctionsLeaks.test_disk_io_counters.<locals>.<lambda>  s    V44EB r2   r   rB   s    r-   test_disk_io_countersz.TestModuleFunctionsLeaks.test_disk_io_counters  s     	BCr2   c                 B    | j                  t        j                         y r$   )r?   rl   pidsrB   s    r-   	test_pidsz"TestModuleFunctionsLeaks.test_pids  s    V[[!r2   c                 (    | j                  d        y )Nc                  .    t        j                  d      S r<  )rl   net_io_countersr3   r2   r-   ra   z?TestModuleFunctionsLeaks.test_net_io_counters.<locals>.<lambda>  s    V335A r2   r   rB   s    r-   test_net_io_countersz-TestModuleFunctionsLeaks.test_net_io_counters  s     	ABr2   r   zneed root accessc                     t        j                  d       t               5  | j                  d        d d d        y # 1 sw Y   y xY w)Nr   r   c                  .    t        j                  d      S )Nr   rH  )rl   net_connectionsr3   r2   r-   ra   z?TestModuleFunctionsLeaks.test_net_connections.<locals>.<lambda>  s    !7!7U!C r2   )rl   rJ  r   r?   rB   s    r-   test_net_connectionsz-TestModuleFunctionsLeaks.test_net_connections  s>     	E* 	ELLCD	E 	E 	Es	   =Ac                 n    t         rdn| j                  }| j                  t        j                  |       y )Ni @ )	tolerance)r	   rM  r?   rl   net_if_addrs)r(   rM  s     r-   test_net_if_addrsz*TestModuleFunctionsLeaks.test_net_if_addrs  s%    !(Idnn	V((I>r2   c                 B    | j                  t        j                         y r$   )r?   rl   net_if_statsrB   s    r-   test_net_if_statsz*TestModuleFunctionsLeaks.test_net_if_stats  s    V(()r2   c                 B    | j                  t        j                         y r$   )r?   rl   sensors_batteryrB   s    r-   test_sensors_batteryz-TestModuleFunctionsLeaks.test_sensors_battery  s     	V++,r2   c                 B    | j                  t        j                         y r$   )r?   rl   sensors_temperaturesrB   s    r-   test_sensors_temperaturesz2TestModuleFunctionsLeaks.test_sensors_temperatures  s     	V001r2   c                 B    | j                  t        j                         y r$   )r?   rl   sensors_fansrB   s    r-   test_sensors_fansz*TestModuleFunctionsLeaks.test_sensors_fans  s     	V(()r2   c                 B    | j                  t        j                         y r$   )r?   rl   	boot_timerB   s    r-   test_boot_timez'TestModuleFunctionsLeaks.test_boot_time  r  r2   c                 B    | j                  t        j                         y r$   )r?   rl   usersrB   s    r-   
test_usersz#TestModuleFunctionsLeaks.test_users  s    V\\"r2   c                 (    | j                  d        y )Nc                  ,    t        j                  d      S )NF)rl   
_set_debugr3   r2   r-   ra   z9TestModuleFunctionsLeaks.test_set_debug.<locals>.<lambda>  s    V..u5 r2   r   rB   s    r-   test_set_debugz'TestModuleFunctionsLeaks.test_set_debug  s    56r2   c                 B    | j                  t        j                         y r$   )r?   rp   winservice_enumeraterB   s    r-   test_win_service_iterz.TestModuleFunctionsLeaks.test_win_service_iter  s    LL223r2   c                      y r$   r3   rB   s    r-   test_win_service_getz-TestModuleFunctionsLeaks.test_win_service_get  s    r2   c                     t        t        j                               j                         | j	                  fd       y )Nc                  .    t         j                         S r$   )rp   winservice_query_configrA   s   r-   ra   zFTestModuleFunctionsLeaks.test_win_service_get_config.<locals>.<lambda>      !=!=d!C r2   nextrl   win_service_iterrA   r?   r(   rA   s    @r-   test_win_service_get_configz4TestModuleFunctionsLeaks.test_win_service_get_config  ,    //12779DLLCDr2   c                     t        t        j                               j                         | j	                  fd       y )Nc                  .    t         j                         S r$   )rp   winservice_query_statusrn  s   r-   ra   zFTestModuleFunctionsLeaks.test_win_service_get_status.<locals>.<lambda>  ro  r2   rp  rs  s    @r-   test_win_service_get_statusz4TestModuleFunctionsLeaks.test_win_service_get_status  ru  r2   c                     t        t        j                               j                         | j	                  fd       y )Nc                  .    t         j                         S r$   )rp   winservice_query_descrrn  s   r-   ra   zKTestModuleFunctionsLeaks.test_win_service_get_description.<locals>.<lambda>  s    !<!<T!B r2   rp  rs  s    @r-    test_win_service_get_descriptionz9TestModuleFunctionsLeaks.test_win_service_get_description  s,    //12779DLLBCr2   N)4r   r   r   r   r=   r4   r  r  r   r  r  r   r   r   platformmachiner   r#  r	   r&  r)  r   r,  r1  r6  r9  r   rr   pathexistsr?  rB  r   rF  getuidrK  rO  rR  r   rU  r   rX  r   r[  r^  ra  re  rh  rj  rt  ry  r}  r3   r2   r-   r  r  R  s   0- = = > > ' ' < < ' ' X__/"(""$/1G X__%7& 8 & X__[.1( 2(, X__UDE) F)JB- X__7bggnn%677= D 	
D
 " "
 X__,,o>C ? C X__U/yryy{a/1CDE E E?
*
 X__,,o>- ? - X__11?C2 D 2 X__))?;* < *
 ' '#7 	4		E	E	D% r2   r  __main__)run_from_name)6r   
__future__r   r/   rr   r~  r   rl   psutil._commonr   r   r   r   r   r	   psutil._compatr
   r   psutil.testsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   _psplatformrp   r|   rb   r'   r4   r6   r   r   r   r  r   psutil.tests.runnerr  __file__r3   r2   r-   <module>r     s   &  	           -   ) % $ # ( , ) - # , ) 1 ' ' # * . ' ) " 6>>	8r:^ r:j3!7 3l Wn-LN L .LXD~ XDv z1( r2   