
    ɧd :                        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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$ dd lm%Z% ej&        j'        Z' ej(                    Z)d!Z*d" Z+ G d# d$e          Z, G d% d&e,          Z- e%j.        e d'           G d( d)e                      Z/ G d* d+e          Z0e1d,k    rdd-l2m3Z3  e3e4           dS dS ).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)unittest   c                      d } | S )zsDecorator for those Linux functions which are implemented in pure
    Python, and which we want to run faster.
    c                 F     t          j                    fd            }|S )Nc                     t           rG| j        j        }	 t          | j        _         | g|R i ||| j        _        S # || j        _        w xY w | g|R i |S N)r   	__class__times	FEW_TIMES)selfargskwargsbeforefuns       :lib/python3.11/site-packages/psutil/tests/test_memleaks.pywrapperz5fewtimes_if_linux.<locals>.decorator.<locals>.wrapperB   s     2-2+4DN(3t5d555f55+1DN((6DN(1111s41$111&111s	   ? A)	functoolswraps)r-   r/   s   ` r.   	decoratorz$fewtimes_if_linux.<locals>.decoratorA   s8    					2 		2 		2 		2 
			2      )r2   s    r.   fewtimes_if_linuxr5   =   s       r3   c                      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,             Z8d-S ).TestProcessObjectLeaksz$Test leaks of Process class methods.c                 j    t          d           }|                    | |j        |j        z              d S r%   )r   test_class_coveragegetterssettersr)   nss     r.   test_coveragez$TestProcessObjectLeaks.test_coverage[   s4    t$$
tRZ"*%<=====r3   c                 D    |                      | j        j                   d S r%   )executeprocnamer)   s    r.   	test_namez TestProcessObjectLeaks.test_name_       TY^$$$$$r3   c                 D    |                      | j        j                   d S r%   )r@   rA   cmdlinerC   s    r.   test_cmdlinez#TestProcessObjectLeaks.test_cmdlinec       TY&'''''r3   c                 D    |                      | j        j                   d S r%   )r@   rA   exerC   s    r.   test_exezTestProcessObjectLeaks.test_exeg       TY]#####r3   c                 D    |                      | j        j                   d S r%   )r@   rA   ppidrC   s    r.   	test_ppidz TestProcessObjectLeaks.test_ppidk   rE   r3   z
POSIX onlyc                 D    |                      | j        j                   d S r%   )r@   rA   uidsrC   s    r.   	test_uidsz TestProcessObjectLeaks.test_uidso         	TY^$$$$$r3   c                 D    |                      | j        j                   d S r%   )r@   rA   gidsrC   s    r.   	test_gidsz TestProcessObjectLeaks.test_gidst   rT   r3   c                 D    |                      | j        j                   d S r%   )r@   rA   statusrC   s    r.   test_statusz"TestProcessObjectLeaks.test_statusy       TY%&&&&&r3   c                 D    |                      | j        j                   d S r%   )r@   rA   nicerC   s    r.   	test_nicez TestProcessObjectLeaks.test_nice}   s    TY^$$$$$r3   c                 n     t                                                                 fd           d S )Nc                  8    j                                        S r%   )rA   r]   )nicenessr)   s   r.   <lambda>z6TestProcessObjectLeaks.test_nice_set.<locals>.<lambda>   s    TY^^H55 r3   )thisprocr]   r@   )r)   ra   s   `@r.   test_nice_setz$TestProcessObjectLeaks.test_nice_set   s6    ==??5555566666r3   not supportedc                 D    |                      | j        j                   d S r%   )r@   rA   ionicerC   s    r.   test_ionicez"TestProcessObjectLeaks.test_ionice   r[   r3   c                 J    t           r4t                                                                fd           d S                       fd           t	          j        t          j        t          j	                    dd          } 
                    t          |           d S )Nc                  8     j                                       S r%   )rA   rg   )r)   values   r.   rb   z8TestProcessObjectLeaks.test_ionice_set.<locals>.<lambda>   s    !1!1%!8!8 r3   c                  L     j                             t          j                  S r%   )rA   rg   psutilIOPRIO_CLASS_NONErC   s   r.   rb   z8TestProcessObjectLeaks.test_ionice_set.<locals>.<lambda>   s    !1!1&2J!K!K r3   r   )r	   rc   rg   r@   r0   partialcextproc_ioprio_setosgetpidexecute_w_excOSError)r)   r-   rk   s   ` @r.   test_ionice_setz&TestProcessObjectLeaks.test_ionice_set   s     	-OO%%ELL8888899999LLKKKKLLL#D$8")++r1MMCw,,,,,r3   c                 D    |                      | j        j                   d S r%   )r@   rA   io_countersrC   s    r.   test_io_countersz'TestProcessObjectLeaks.test_io_counters   !     	TY*+++++r3   zworthless on POSIXc                     t          j                                                     |                     | j        j                   d S r%   )rm   Processusernamer@   rA   rC   s    r.   test_usernamez$TestProcessObjectLeaks.test_username   s;     	!!###TY'(((((r3   c                 D    |                      | j        j                   d S r%   )r@   rA   create_timerC   s    r.   test_create_timez'TestProcessObjectLeaks.test_create_time       TY*+++++r3   )only_ifc                 D    |                      | j        j                   d S r%   )r@   rA   num_threadsrC   s    r.   test_num_threadsz'TestProcessObjectLeaks.test_num_threads   r{   r3   WINDOWS onlyc                 D    |                      | j        j                   d S r%   )r@   rA   num_handlesrC   s    r.   test_num_handlesz'TestProcessObjectLeaks.test_num_handles   r   r3   c                 D    |                      | j        j                   d S r%   )r@   rA   num_fdsrC   s    r.   test_num_fdsz#TestProcessObjectLeaks.test_num_fds   !     	TY&'''''r3   c                 D    |                      | j        j                   d S r%   )r@   rA   num_ctx_switchesrC   s    r.   test_num_ctx_switchesz,TestProcessObjectLeaks.test_num_ctx_switches       TY/00000r3   c                 D    |                      | j        j                   d S r%   )r@   rA   threadsrC   s    r.   test_threadsz#TestProcessObjectLeaks.test_threads   r   r3   c                 D    |                      | j        j                   d S r%   )r@   rA   	cpu_timesrC   s    r.   test_cpu_timesz%TestProcessObjectLeaks.test_cpu_times   s    TY()))))r3   c                 D    |                      | j        j                   d S r%   )r@   rA   cpu_numrC   s    r.   test_cpu_numz#TestProcessObjectLeaks.test_cpu_num   r   r3   c                 D    |                      | j        j                   d S r%   )r@   rA   memory_inforC   s    r.   test_memory_infoz'TestProcessObjectLeaks.test_memory_info   r   r3   c                 D    |                      | j        j                   d S r%   )r@   rA   memory_full_inforC   s    r.   test_memory_full_infoz,TestProcessObjectLeaks.test_memory_full_info   r   r3   c                 D    |                      | j        j                   d S r%   )r@   rA   terminalrC   s    r.   test_terminalz$TestProcessObjectLeaks.test_terminal   s!     	TY'(((((r3   c                 r    t           rt          n| j        }|                     | j        j        |           d S )Nr'   )r   r(   r'   r@   rA   resumer)   r'   s     r.   test_resumez"TestProcessObjectLeaks.test_resume   s3    "2		
TY%U33333r3   c                 D    |                      | j        j                   d S r%   )r@   rA   cwdrC   s    r.   test_cwdzTestProcessObjectLeaks.test_cwd   rM   r3   c                 D    |                      | j        j                   d S r%   )r@   rA   cpu_affinityrC   s    r.   test_cpu_affinityz(TestProcessObjectLeaks.test_cpu_affinity   s    TY+,,,,,r3   c                      t                                                                 fd                                t           fd           d S )Nc                  8    j                                        S r%   rA   r   )affinityr)   s   r.   rb   z>TestProcessObjectLeaks.test_cpu_affinity_set.<locals>.<lambda>   s    TY33H== r3   c                  :     j                             dg          S Nro   r   rC   s   r.   rb   z>TestProcessObjectLeaks.test_cpu_affinity_set.<locals>.<lambda>   s    	 6 6t < < r3   )rc   r   r@   ru   
ValueError)r)   r   s   `@r.   test_cpu_affinity_setz,TestProcessObjectLeaks.test_cpu_affinity_set   se    ((**=====>>><<<<	> 	> 	> 	> 	>r3   c                     t          t                      d          5  |                     | j        j                   d d d            d S # 1 swxY w Y   d S )Nw)openr   r@   rA   
open_filesrC   s    r.   test_open_filesz&TestProcessObjectLeaks.test_open_files   s    *,,$$ 	/ 	/LL-...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/s    A

AAc                 D    |                      | j        j                   d S r%   )r@   rA   memory_mapsrC   s    r.   test_memory_mapsz'TestProcessObjectLeaks.test_memory_maps   r{   r3   z
LINUX onlyc                 8                            fd           d S )Nc                  L     j                             t          j                  S r%   rA   rlimitrm   RLIMIT_NOFILErC   s   r.   rb   z4TestProcessObjectLeaks.test_rlimit.<locals>.<lambda>   s    TY--f.BCC r3   r@   rC   s   `r.   test_rlimitz"TestProcessObjectLeaks.test_rlimit   s'     	CCCCDDDDDr3   c                      t                               t          j                                        fd                                t          t          f fd           d S )Nc                  N    j                             t          j                   S r%   r   )limitr)   s   r.   rb   z8TestProcessObjectLeaks.test_rlimit_set.<locals>.<lambda>   s    TY--f.BEJJ r3   c                  8     j                             d          S r   )rA   r   rC   s   r.   rb   z8TestProcessObjectLeaks.test_rlimit_set.<locals>.<lambda>   s    $):J:J2:N:N r3   )rc   r   rm   r   r@   ru   rv   r   )r)   r   s   `@r.   test_rlimit_setz&TestProcessObjectLeaks.test_rlimit_set   sd      455JJJJJKKKGZ02N2N2N2NOOOOOr3   zworthless on WINDOWSc                      t                      5  t          rdnd                      fd           d d d            d S # 1 swxY w Y   d S )Ninetallc                  8    j                                        S r%   )rA   connections)kindr)   s   r.   rb   z9TestProcessObjectLeaks.test_connections.<locals>.<lambda>  s    !6!6t!<!< r3   )r   r   r@   )r)   r   s   `@r.   test_connectionsz'TestProcessObjectLeaks.test_connections   s      	> 	>"-66DLL<<<<<===	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>s   %AA
Ac                 D    |                      | j        j                   d S r%   )r@   rA   environrC   s    r.   test_environz#TestProcessObjectLeaks.test_environ  rI   r3   c                 2    |                      d            d S )Nc                  X    t                               t          j                              S r%   )rq   	proc_infors   rt   r4   r3   r.   rb   z7TestProcessObjectLeaks.test_proc_info.<locals>.<lambda>	  s    T^^BIKK88 r3   r   rC   s    r.   test_proc_infoz%TestProcessObjectLeaks.test_proc_info  s    8899999r3   N)9__name__
__module____qualname____doc__rc   rA   r>   r5   rD   rH   rL   rP   r    skipIfr   rS   rW   rZ   r^   rd   r   rh   rw   r   rz   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   r4   r3   r.   r7   r7   V   s       ..D> > > % % % ( ( ( $ $ $ % % % X_Y--% %  .-% X_Y--% %  .-% ' ' '% % %7 7 7 X_^_55' ' 65' X_^_55- - 65- X_--??, ,  @?, X_U011) ) 21)
 , , , 7+++, , ,+ , X_[.11, , 21, X_Y--( (  .-( 1 1 1 7+++( ( ,+ ( * * * X_))?;;( ( <; ( , , , 1 1 1 X_Y--) )  .-)4 4 4 $ $ $ X_))?;;- - <;- X_))?;;> > <;> / / / X_(/::, ,  ;:, X_Y--X_^_55E E 65 .-E X_Y--X_^_55P P 65 .-P
  X_W455> > 65 > X__o66( ( 76( X_[.11: : 21: : :r3   r7   c                        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                                                       t                      | _        t	          j        | j        j                  | _        | j                                         | j        	                                 d S r%   )
r   
setUpClassr   subprm   r}   pidrA   killwaitclsr&   s    r.   r   z%TestTerminatedProcessLeaks.setUpClass  s]    !##>#(,//r3   c                 p    t                                                       t          | j                   d S r%   )r   tearDownClassr   r   r   s    r.   r   z(TestTerminatedProcessLeaks.tearDownClass  s/    #(r3   c                 H    	  |             d S # t           j        $ r Y d S w xY wr%   )rm   NoSuchProcess)r)   r-   s     r.   callzTestTerminatedProcessLeaks.call   s;    	CEEEEE# 	 	 	DD	s   
 !!c                 D    |                      | j        j                   d S r%   )r@   rA   r   rC   s    r.   	test_killz$TestTerminatedProcessLeaks.test_kill(      LL(((((r3   c                 D    |                      | j        j                   d S r%   )r@   rA   r   rC   s    r.   test_terminatez)TestTerminatedProcessLeaks.test_terminate+  s    LL,-----r3   c                 D    |                      | j        j                   d S r%   )r@   rA   suspendrC   s    r.   test_suspendz'TestTerminatedProcessLeaks.test_suspend.  s    LL*+++++r3   c                 D    |                      | j        j                   d S r%   )r@   rA   r   rC   s    r.   r   z&TestTerminatedProcessLeaks.test_resume1  s    LL)*****r3   c                 D    |                      | j        j                   d S r%   )r@   rA   r   rC   s    r.   	test_waitz$TestTerminatedProcessLeaks.test_wait4  r   r3   c                 <      fd}                      |           d S )Nc                  p    	 t                                j        j                  S # t          $ r Y d S w xY wr%   )rq   r   rA   r   r
   rC   s   r.   r   z7TestTerminatedProcessLeaks.test_proc_info.<locals>.call9  s@    >>$)-888)   DDs   #' 
55r   )r)   r   s   ` r.   r   z)TestTerminatedProcessLeaks.test_proc_info7  s6         LLr3   )r   r   r   r   classmethodr   r   r   r	   r   r   r   r   r   r   __classcell__)r&   s   @r.   r   r     s              [     [    	) 	) 	)	. 	. 	.	, 	, 	,	+ 	+ 	+	) 	) 	)	 	 	 	 	 	 	#   r3   r   r   c                       e Zd Zd Zd ZdS )TestProcessDualImplementationc                 2    |                      d            d S )Nc                  \    t                               t          j                    d          S )NTuse_pebrq   proc_cmdliners   rt   r4   r3   r.   rb   zETestProcessDualImplementation.test_cmdline_peb_true.<locals>.<lambda>F  s    T..ry{{D.II r3   r   rC   s    r.   test_cmdline_peb_truez3TestProcessDualImplementation.test_cmdline_peb_trueE  s    IIJJJJJr3   c                 2    |                      d            d S )Nc                  \    t                               t          j                    d          S )NFr  r  r4   r3   r.   rb   zFTestProcessDualImplementation.test_cmdline_peb_false.<locals>.<lambda>I  s    T..ry{{E.JJ r3   r   rC   s    r.   test_cmdline_peb_falsez4TestProcessDualImplementation.test_cmdline_peb_falseH  s    JJKKKKKr3   N)r   r   r   r  r	  r4   r3   r.   r   r   B  s:        K K KL L L L Lr3   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 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oej                            d           d           e            d                         Z e            d             Z e             ej        e d          d                         Z e             ej        eo ej                     dk    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# Z.d$ Z/d% Z0d& Z1d'S d'S )(TestModuleFunctionsLeaksz&Test leaks of psutil module functions.c                 X    t                      }|                    | |j                   d S r%   )r   r9   r   r<   s     r.   r>   z&TestModuleFunctionsLeaks.test_coverageT  s+    
tRV,,,,,r3   c                 2    |                      d            d S )Nc                  ,    t          j        d          S )NTlogicalrm   	cpu_countr4   r3   r.   rb   z9TestModuleFunctionsLeaks.test_cpu_count.<locals>.<lambda>\  s    V-d;;; r3   r   rC   s    r.   test_cpu_countz'TestModuleFunctionsLeaks.test_cpu_countZ  s    ;;<<<<<r3   c                 2    |                      d            d S )Nc                  ,    t          j        d          S )NFr  r  r4   r3   r.   rb   z?TestModuleFunctionsLeaks.test_cpu_count_cores.<locals>.<lambda>`  s    V-e<<< r3   r   rC   s    r.   test_cpu_count_coresz-TestModuleFunctionsLeaks.test_cpu_count_cores^  s    <<=====r3   c                 D    |                      t          j                   d S r%   )r@   rm   r   rC   s    r.   r   z'TestModuleFunctionsLeaks.test_cpu_timesb      V%&&&&&r3   c                 2    |                      d            d S )Nc                  ,    t          j        d          S )NT)percpu)rm   r   r4   r3   r.   rb   z=TestModuleFunctionsLeaks.test_per_cpu_times.<locals>.<lambda>h  s    V-T::: r3   r   rC   s    r.   test_per_cpu_timesz+TestModuleFunctionsLeaks.test_per_cpu_timesf  s    ::;;;;;r3   c                 D    |                      t          j                   d S r%   )r@   rm   	cpu_statsrC   s    r.   test_cpu_statsz'TestModuleFunctionsLeaks.test_cpu_statsj  r  r3   re   c                 D    |                      t          j                   d S r%   )r@   rm   cpu_freqrC   s    r.   test_cpu_freqz&TestModuleFunctionsLeaks.test_cpu_freqn  s     	V_%%%%%r3   r   c                 j    t          j                     |                     t           j                   d S r%   )rm   
getloadavgr@   rC   s    r.   test_getloadavgz(TestModuleFunctionsLeaks.test_getloadavgs  s,    V&'''''r3   c                 D    |                      t          j                   d S r%   )r@   rm   virtual_memoryrC   s    r.   test_virtual_memoryz,TestModuleFunctionsLeaks.test_virtual_memoryz  s    V*+++++r3   z&worthless on SUNOS (uses a subprocess)c                 D    |                      t          j                   d S r%   )r@   rm   swap_memoryrC   s    r.   test_swap_memoryz)TestModuleFunctionsLeaks.test_swap_memory~  s    V'(((((r3   c                 `    t           rt          n| j        }|                     d |           d S )Nc                  L    t          j        t          j                              S r%   )rm   
pid_existsrs   rt   r4   r3   r.   rb   z:TestModuleFunctionsLeaks.test_pid_exists.<locals>.<lambda>  s    V.ry{{;; r3   r   r   r(   r'   r@   r   s     r.   test_pid_existsz(TestModuleFunctionsLeaks.test_pid_exists  s2    "2		
;;5IIIIIr3   c                 `    t           rt          n| j        }|                     d |           d S )Nc                  *    t          j        d          S )N.)rm   
disk_usager4   r3   r.   rb   z:TestModuleFunctionsLeaks.test_disk_usage.<locals>.<lambda>  s    V.s33 r3   r   r/  r   s     r.   test_disk_usagez(TestModuleFunctionsLeaks.test_disk_usage  s2    "2		
335AAAAAr3   c                 D    |                      t          j                   d S r%   )r@   rm   disk_partitionsrC   s    r.   test_disk_partitionsz-TestModuleFunctionsLeaks.test_disk_partitions  s    V+,,,,,r3   z/proc/diskstatsz3/proc/diskstats not available on this Linux versionc                 2    |                      d            d S )Nc                  ,    t          j        d          S NF)nowrap)rm   disk_io_countersr4   r3   r.   rb   z@TestModuleFunctionsLeaks.test_disk_io_counters.<locals>.<lambda>  s    V4EBBB r3   r   rC   s    r.   test_disk_io_countersz.TestModuleFunctionsLeaks.test_disk_io_counters  s      	BBCCCCCr3   c                 D    |                      t          j                   d S r%   )r@   rm   pidsrC   s    r.   	test_pidsz"TestModuleFunctionsLeaks.test_pids  s    V[!!!!!r3   c                 2    |                      d            d S )Nc                  ,    t          j        d          S r;  )rm   net_io_countersr4   r3   r.   rb   z?TestModuleFunctionsLeaks.test_net_io_counters.<locals>.<lambda>  s    V35AAA r3   r   rC   s    r.   test_net_io_countersz-TestModuleFunctionsLeaks.test_net_io_counters  s      	AABBBBBr3   r   zneed root accessc                     t          j        d           t                      5  |                     d            d d d            d S # 1 swxY w Y   d S )Nr   r   c                  ,    t          j        d          S )Nr   rG  )rm   net_connectionsr4   r3   r.   rb   z?TestModuleFunctionsLeaks.test_net_connections.<locals>.<lambda>  s    !7U!C!C!C r3   )rm   rI  r   r@   rC   s    r.   test_net_connectionsz-TestModuleFunctionsLeaks.test_net_connections  s     	E**** 	E 	ELLCCDDD	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	Es   AAAc                 h    t           rdn| j        }|                     t          j        |           d S )Ni @ )	tolerance)r	   rL  r@   rm   net_if_addrs)r)   rL  s     r.   test_net_if_addrsz*TestModuleFunctionsLeaks.test_net_if_addrs  s1    !(<IIdn	V(I>>>>>r3   c                 D    |                      t          j                   d S r%   )r@   rm   net_if_statsrC   s    r.   test_net_if_statsz*TestModuleFunctionsLeaks.test_net_if_stats  s    V()))))r3   c                 D    |                      t          j                   d S r%   )r@   rm   sensors_batteryrC   s    r.   test_sensors_batteryz-TestModuleFunctionsLeaks.test_sensors_battery  s     	V+,,,,,r3   c                 D    |                      t          j                   d S r%   )r@   rm   sensors_temperaturesrC   s    r.   test_sensors_temperaturesz2TestModuleFunctionsLeaks.test_sensors_temperatures  s     	V011111r3   c                 D    |                      t          j                   d S r%   )r@   rm   sensors_fansrC   s    r.   test_sensors_fansz*TestModuleFunctionsLeaks.test_sensors_fans  s     	V()))))r3   c                 D    |                      t          j                   d S r%   )r@   rm   	boot_timerC   s    r.   test_boot_timez'TestModuleFunctionsLeaks.test_boot_time  r  r3   c                 D    |                      t          j                   d S r%   )r@   rm   usersrC   s    r.   
test_usersz#TestModuleFunctionsLeaks.test_users  s    V\"""""r3   c                 2    |                      d            d S )Nc                  *    t          j        d          S )NF)rm   
_set_debugr4   r3   r.   rb   z9TestModuleFunctionsLeaks.test_set_debug.<locals>.<lambda>  s    V.u55 r3   r   rC   s    r.   test_set_debugz'TestModuleFunctionsLeaks.test_set_debug  s    5566666r3   c                 D    |                      t          j                   d S r%   )r@   rq   winservice_enumeraterC   s    r.   test_win_service_iterz.TestModuleFunctionsLeaks.test_win_service_iter  s    LL233333r3   c                     d S r%   r4   rC   s    r.   test_win_service_getz-TestModuleFunctionsLeaks.test_win_service_get  s    Dr3   c                     t          t          j                                                              |                     fd           d S )Nc                  8    t                                          S r%   )rq   winservice_query_configrB   s   r.   rb   zFTestModuleFunctionsLeaks.test_win_service_get_config.<locals>.<lambda>      !=!=d!C!C r3   nextrm   win_service_iterrB   r@   r)   rB   s    @r.   test_win_service_get_configz4TestModuleFunctionsLeaks.test_win_service_get_config  G    /11227799DLLCCCCDDDDDr3   c                     t          t          j                                                              |                     fd           d S )Nc                  8    t                                          S r%   )rq   winservice_query_statusrm  s   r.   rb   zFTestModuleFunctionsLeaks.test_win_service_get_status.<locals>.<lambda>  rn  r3   ro  rr  s    @r.   test_win_service_get_statusz4TestModuleFunctionsLeaks.test_win_service_get_status  rt  r3   c                     t          t          j                                                              |                     fd           d S )Nc                  8    t                                          S r%   )rq   winservice_query_descrrm  s   r.   rb   zKTestModuleFunctionsLeaks.test_win_service_get_description.<locals>.<lambda>  s    !<!<T!B!B r3   ro  rr  s    @r.    test_win_service_get_descriptionz9TestModuleFunctionsLeaks.test_win_service_get_description  sG    /11227799DLLBBBBCCCCCr3   N)2r   r   r   r   r>   r5   r  r  r   r  r  r    r   r   r"  r	   r%  r(  r   r+  r0  r5  r8  r   rs   pathexistsr>  rA  r   rE  r   getuidrJ  rN  rQ  r   rT  r   rW  r   rZ  r]  r`  rd  rg  ri  rs  rx  r|  r4   r3   r.   r  r  Q  st       00- - - = = = > > > ' ' ' < < < ' ' ' X_%77& & 87 & X_[.11( ( 21(, , , X_UDEE) ) FE)J J JB B B- - - X_UD27>>2C#D#DDJL LD D L LD
 " " "
 X_,,o>>C C ?> C X_U/yry{{a/1CDDE E ED E? ? ?
* * *
 X_,,o>>- - ?> - X_11?CC2 2 DC 2 X_))?;;* * <; *
 ' ' '# # #7 7 7  D	4 	4 	4	 	 		E 	E 	E	E 	E 	E	D 	D 	D 	D 	D%D Dr3   r  __main__)run_from_name)5r   
__future__r   r0   rs   rm   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   r    _psplatformrq   r}   rc   r(   r5   r7   r   r   r   r  r   psutil.tests.runnerr  __file__r4   r3   r.   <module>r     s  	 	 & % % % % %     				                                          - - - - - -             ) ) ) ) ) ) % % % % % % $ $ $ $ $ $ # # # # # # ( ( ( ( ( ( , , , , , , ) ) ) ) ) ) - - - - - - # # # # # # , , , , , , ) ) ) ) ) ) 1 1 1 1 1 1 ' ' ' ' ' ' ' ' ' ' ' ' # # # # # # * * * * * * . . . . . . ' ' ' ' ' ' ) ) ) ) ) ) " " " " " " ! ! ! ! ! ! 6>	  2s: s: s: s: s:^ s: s: s:l3 3 3 3 3!7 3 3 3l Wn--L L L L LN L L .-LRD RD RD RD RD~ RD RD RDj z 111111M( r3   