o
    ˆ¶¹a :  ã                   @   s  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 (¡ Z)d!Z*d"d#„ Z+G d$d%„ d%eƒZ,G d&d'„ d'e,ƒZ-e% .e d(¡G d)d*„ d*eƒƒZ/G d+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                  C   s   dd„ } | S )zsDecorator for those Linux functions which are implemented in pure
    Python, and which we want to run faster.
    c                    s   t  ˆ ¡‡ fdd„ƒ}|S )Nc                    sV   t r | jj}zt| j_ˆ | g|¢R i |¤ŽW || j_S || j_w ˆ | g|¢R i |¤ŽS ©N)r   Ú	__class__ÚtimesÚ	FEW_TIMES)ÚselfÚargsÚkwargsÚbefore©Úfun© ú</usr/lib/python3/dist-packages/psutil/tests/test_memleaks.pyÚwrapperB   s   z5fewtimes_if_linux.<locals>.decorator.<locals>.wrapper)Ú	functoolsÚwraps)r*   r-   r+   r)   r,   Ú	decoratorA   s   
z$fewtimes_if_linux.<locals>.decoratorr+   )r0   r+   r+   r,   Úfewtimes_if_linux=   s   r1   c                   @   sà  e Zd ZdZeZdd„ Zeƒ dd„ ƒZeƒ dd„ ƒZ	eƒ dd	„ ƒZ
eƒ d
d„ ƒZe e d¡eƒ dd„ ƒƒZe e d¡eƒ dd„ ƒƒZeƒ dd„ ƒZdd„ Zdd„ Ze e d¡dd„ ƒZe e d¡dd„ ƒZe e d¡eƒ dd„ ƒƒZe ed¡dd „ ƒZeƒ d!d"„ ƒZeƒ eed#�d$d%„ ƒƒZe e d&¡d'd(„ ƒZe e d¡eƒ d)d*„ ƒƒZ eƒ d+d,„ ƒZ!eƒ eed#�d-d.„ ƒƒZ"eƒ d/d0„ ƒZ#eƒ e e$ d¡d1d2„ ƒƒZ%eƒ d3d4„ ƒZ&eƒ d5d6„ ƒZ'e e d¡eƒ d7d8„ ƒƒZ(d9d:„ Z)eƒ d;d<„ ƒZ*e e+ d¡d=d>„ ƒZ,e e+ d¡d?d@„ ƒZ-eƒ dAdB„ ƒZ.e e/ d¡eƒ dCdD„ ƒƒZ0e e1 dE¡e e2 d¡dFdG„ ƒƒZ3e e1 dE¡e e2 d¡dHdI„ ƒƒZ4eƒ e edJ¡dKdL„ ƒƒZ5e e6 d¡dMdN„ ƒZ7e e d&¡dOdP„ ƒZ8dQS )RÚTestProcessObjectLeaksz$Test leaks of Process class methods.c                 C   s    t d ƒ}| | |j|j ¡ d S r!   )r   Útest_class_coverageÚgettersÚsetters©r%   Únsr+   r+   r,   Útest_coverage[   ó   z$TestProcessObjectLeaks.test_coveragec                 C   ó   |   | jj¡ d S r!   )ÚexecuteÚprocÚname©r%   r+   r+   r,   Ú	test_name_   ó   z TestProcessObjectLeaks.test_namec                 C   r:   r!   )r;   r<   Úcmdliner>   r+   r+   r,   Útest_cmdlinec   r@   z#TestProcessObjectLeaks.test_cmdlinec                 C   r:   r!   )r;   r<   Úexer>   r+   r+   r,   Útest_exeg   r@   zTestProcessObjectLeaks.test_exec                 C   r:   r!   )r;   r<   Úppidr>   r+   r+   r,   Ú	test_ppidk   r@   z TestProcessObjectLeaks.test_ppidz
POSIX onlyc                 C   r:   r!   )r;   r<   Úuidsr>   r+   r+   r,   Ú	test_uidso   ó   z TestProcessObjectLeaks.test_uidsc                 C   r:   r!   )r;   r<   Úgidsr>   r+   r+   r,   Ú	test_gidst   rI   z TestProcessObjectLeaks.test_gidsc                 C   r:   r!   )r;   r<   Ústatusr>   r+   r+   r,   Útest_statusy   r@   z"TestProcessObjectLeaks.test_statusc                 C   r:   r!   )r;   r<   Únicer>   r+   r+   r,   Ú	test_nice}   ó   z TestProcessObjectLeaks.test_nicec                    s    t  ¡ ‰ ˆ ‡ ‡fdd„¡ d S )Nc                      ó   ˆj  ˆ ¡S r!   )r<   rN   r+   ©Únicenessr%   r+   r,   Ú<lambda>‚   ó    z6TestProcessObjectLeaks.test_nice_set.<locals>.<lambda>)ÚthisprocrN   r;   r>   r+   rR   r,   Útest_nice_set€   r9   z$TestProcessObjectLeaks.test_nice_setúnot supportedc                 C   r:   r!   )r;   r<   Úionicer>   r+   r+   r,   Útest_ionice„   r@   z"TestProcessObjectLeaks.test_ionicec                    s\   t rt ¡ ‰ˆ  ‡ ‡fdd„¡ d S ˆ  ‡ fdd„¡ t tjt 	¡ dd¡}ˆ  
t|¡ d S )Nc                      s   ˆ j  ˆ¡S r!   )r<   rY   r+   ©r%   Úvaluer+   r,   rT   Œ   rU   z8TestProcessObjectLeaks.test_ionice_set.<locals>.<lambda>c                      ó   ˆ j  tj¡S r!   )r<   rY   ÚpsutilÚIOPRIO_CLASS_NONEr+   r>   r+   r,   rT   Ž   ó    éÿÿÿÿr   )r   rV   rY   r;   r.   ÚpartialÚcextÚproc_ioprio_setÚosÚgetpidÚexecute_w_excÚOSError©r%   r*   r+   r[   r,   Útest_ionice_setˆ   s   z&TestProcessObjectLeaks.test_ionice_setc                 C   r:   r!   )r;   r<   Úio_countersr>   r+   r+   r,   Útest_io_counters’   rI   z'TestProcessObjectLeaks.test_io_counterszworthless on POSIXc                 C   s   t  ¡  ¡  |  | jj¡ d S r!   )r^   ÚProcessÚusernamer;   r<   r>   r+   r+   r,   Útest_username—   s   z$TestProcessObjectLeaks.test_usernamec                 C   r:   r!   )r;   r<   Úcreate_timer>   r+   r+   r,   Útest_create_time�   r@   z'TestProcessObjectLeaks.test_create_time)Úonly_ifc                 C   r:   r!   )r;   r<   Únum_threadsr>   r+   r+   r,   Útest_num_threads¡   rI   z'TestProcessObjectLeaks.test_num_threadsúWINDOWS onlyc                 C   r:   r!   )r;   r<   Únum_handlesr>   r+   r+   r,   Útest_num_handles¦   r@   z'TestProcessObjectLeaks.test_num_handlesc                 C   r:   r!   )r;   r<   Únum_fdsr>   r+   r+   r,   Útest_num_fdsª   rI   z#TestProcessObjectLeaks.test_num_fdsc                 C   r:   r!   )r;   r<   Únum_ctx_switchesr>   r+   r+   r,   Útest_num_ctx_switches¯   r@   z,TestProcessObjectLeaks.test_num_ctx_switchesc                 C   r:   r!   )r;   r<   Úthreadsr>   r+   r+   r,   Útest_threads³   rI   z#TestProcessObjectLeaks.test_threadsc                 C   r:   r!   )r;   r<   Ú	cpu_timesr>   r+   r+   r,   Útest_cpu_times¸   r@   z%TestProcessObjectLeaks.test_cpu_timesc                 C   r:   r!   )r;   r<   Úcpu_numr>   r+   r+   r,   Útest_cpu_num¼   rI   z#TestProcessObjectLeaks.test_cpu_numc                 C   r:   r!   )r;   r<   Úmemory_infor>   r+   r+   r,   Útest_memory_infoÁ   r@   z'TestProcessObjectLeaks.test_memory_infoc                 C   r:   r!   )r;   r<   Úmemory_full_infor>   r+   r+   r,   Útest_memory_full_infoÅ   r@   z,TestProcessObjectLeaks.test_memory_full_infoc                 C   r:   r!   )r;   r<   Úterminalr>   r+   r+   r,   Útest_terminalÉ   rI   z$TestProcessObjectLeaks.test_terminalc                 C   s$   t rtn| j}| j| jj|d� d S )N©r#   )r   r$   r#   r;   r<   Úresume©r%   r#   r+   r+   r,   Útest_resumeÎ   ó   z"TestProcessObjectLeaks.test_resumec                 C   r:   r!   )r;   r<   Úcwdr>   r+   r+   r,   Útest_cwdÒ   r@   zTestProcessObjectLeaks.test_cwdc                 C   r:   r!   )r;   r<   Úcpu_affinityr>   r+   r+   r,   Útest_cpu_affinityÖ   r@   z(TestProcessObjectLeaks.test_cpu_affinityc                    s4   t  ¡ ‰ ˆ ‡ ‡fdd„¡ ˆ t‡fdd„¡ d S )Nc                      rQ   r!   ©r<   r�   r+   ©Úaffinityr%   r+   r,   rT   Ý   rU   z>TestProcessObjectLeaks.test_cpu_affinity_set.<locals>.<lambda>c                      s   ˆ j  dg¡S ©Nra   r‘   r+   r>   r+   r,   rT   ß   r`   )rV   r�   r;   rg   Ú
ValueErrorr>   r+   r’   r,   Útest_cpu_affinity_setÚ   s
   ÿz,TestProcessObjectLeaks.test_cpu_affinity_setc                 C   s@   t tƒ dƒ� |  | jj¡ W d   ƒ d S 1 sw   Y  d S )NÚw)Úopenr   r;   r<   Ú
open_filesr>   r+   r+   r,   Útest_open_filesá   s   "ÿz&TestProcessObjectLeaks.test_open_filesc                 C   r:   r!   )r;   r<   Úmemory_mapsr>   r+   r+   r,   Útest_memory_mapsæ   rI   z'TestProcessObjectLeaks.test_memory_mapsz
LINUX onlyc                    s   ˆ   ‡ fdd„¡ d S )Nc                      r]   r!   ©r<   Úrlimitr^   ÚRLIMIT_NOFILEr+   r>   r+   r,   rT   î   r`   z4TestProcessObjectLeaks.test_rlimit.<locals>.<lambda>©r;   r>   r+   r>   r,   Útest_rlimitë   s   z"TestProcessObjectLeaks.test_rlimitc                    s<   t  tj¡‰ ˆ ‡ ‡fdd„¡ ˆ ttf‡fdd„¡ d S )Nc                      s   ˆj  tjˆ ¡S r!   r�   r+   ©Úlimitr%   r+   r,   rT   ô   s    z8TestProcessObjectLeaks.test_rlimit_set.<locals>.<lambda>c                      s   ˆ j  d¡S r”   )r<   rž   r+   r>   r+   r,   rT   õ   rU   )rV   rž   r^   rŸ   r;   rg   rh   r•   r>   r+   r¢   r,   Útest_rlimit_setð   s   z&TestProcessObjectLeaks.test_rlimit_setzworthless on WINDOWSc                    sL   t ƒ � trdnd‰ ˆ ‡ ‡fdd„¡ W d   ƒ d S 1 sw   Y  d S )NÚinetÚallc                      rQ   r!   )r<   Úconnectionsr+   ©Úkindr%   r+   r,   rT     rU   z9TestProcessObjectLeaks.test_connections.<locals>.<lambda>)r   r   r;   r>   r+   r¨   r,   Útest_connections÷   s   "þz'TestProcessObjectLeaks.test_connectionsc                 C   r:   r!   )r;   r<   Úenvironr>   r+   r+   r,   Útest_environ  r@   z#TestProcessObjectLeaks.test_environc                 C   ó   |   dd„ ¡ d S )Nc                   S   ó   t  t ¡ ¡S r!   )rc   Ú	proc_infore   rf   r+   r+   r+   r,   rT   	  r`   z7TestProcessObjectLeaks.test_proc_info.<locals>.<lambda>r    r>   r+   r+   r,   Útest_proc_info  r@   z%TestProcessObjectLeaks.test_proc_infoN)9Ú__name__Ú
__module__Ú__qualname__Ú__doc__rV   r<   r8   r1   r?   rB   rD   rF   r   ÚskipIfr   rH   rK   rM   rO   rW   r   rZ   rj   r   rl   ro   rq   r   r   rt   r   rw   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,   r2   V   s¦    






	













r2   c                       sx   e Zd ZdZe‡ fdd„ƒZe‡ fdd„ƒZdd„ Zer8dd	„ Z	d
d„ Z
dd„ Zdd„ Zdd„ Zdd„ Z‡  ZS ‡  ZS )ÚTestTerminatedProcessLeakszñRepeat 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                    s:   t ƒ  ¡  tƒ | _t | jj¡| _| j ¡  | j 	¡  d S r!   )
r
   Ú
setUpClassr   Úsubpr^   rm   Úpidr<   ÚkillÚwait©Úcls©r"   r+   r,   r·     s
   

z%TestTerminatedProcessLeaks.setUpClassc                    s   t ƒ  ¡  t| jƒ d S r!   )r
   ÚtearDownClassr   r¸   r¼   r¾   r+   r,   r¿     s   
z(TestTerminatedProcessLeaks.tearDownClassc                 C   s$   z|ƒ  W d S  t jy   Y d S w r!   )r^   ÚNoSuchProcessri   r+   r+   r,   Úcall   s
   ÿzTestTerminatedProcessLeaks.callc                 C   r:   r!   )r;   r<   rº   r>   r+   r+   r,   Ú	test_kill(  rP   z$TestTerminatedProcessLeaks.test_killc                 C   r:   r!   )r;   r<   r   r>   r+   r+   r,   Útest_terminate+  rP   z)TestTerminatedProcessLeaks.test_terminatec                 C   r:   r!   )r;   r<   Úsuspendr>   r+   r+   r,   Útest_suspend.  rP   z'TestTerminatedProcessLeaks.test_suspendc                 C   r:   r!   )r;   r<   r‰   r>   r+   r+   r,   r‹   1  rP   z&TestTerminatedProcessLeaks.test_resumec                 C   r:   r!   )r;   r<   r»   r>   r+   r+   r,   Ú	test_wait4  rP   z$TestTerminatedProcessLeaks.test_waitc                    s   ‡ fdd„}ˆ   |¡ d S )Nc                      s&   zt  ˆ jj¡W S  ty   Y d S w r!   )rc   r¯   r<   r¹   r	   r+   r>   r+   r,   rÁ   9  s
   ÿz7TestTerminatedProcessLeaks.test_proc_info.<locals>.callr    )r%   rÁ   r+   r>   r,   r°   7  s   z)TestTerminatedProcessLeaks.test_proc_info)r±   r²   r³   r´   Úclassmethodr·   r¿   rÁ   r   rÂ   rÃ   rÅ   r‹   rÆ   r°   Ú__classcell__r+   r+   r¾   r,   r¶     s    ïr¶   ru   c                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚTestProcessDualImplementationc                 C   r­   )Nc                   S   ó   t jt ¡ dd�S )NT©Úuse_peb©rc   Úproc_cmdlinere   rf   r+   r+   r+   r,   rT   F  ó    zETestProcessDualImplementation.test_cmdline_peb_true.<locals>.<lambda>r    r>   r+   r+   r,   Útest_cmdline_peb_trueE  rP   z3TestProcessDualImplementation.test_cmdline_peb_truec                 C   r­   )Nc                   S   rÊ   )NFrË   rÍ   r+   r+   r+   r,   rT   I  rÏ   zFTestProcessDualImplementation.test_cmdline_peb_false.<locals>.<lambda>r    r>   r+   r+   r,   Útest_cmdline_peb_falseH  rP   z4TestProcessDualImplementation.test_cmdline_peb_falseN)r±   r²   r³   rÐ   rÑ   r+   r+   r+   r,   rÉ   B  s    rÉ   c                   @   sî  e Zd ZdZdd„ Zeƒ dd„ ƒZeƒ dd„ ƒZeƒ dd	„ ƒZeƒ d
d„ ƒZ	eƒ dd„ ƒZ
eƒ e e d¡dd„ ƒƒZe e d¡dd„ ƒZdd„ Ze ed¡dd„ ƒZdd„ Zdd„ Zdd„ Ze eojej d¡ d ¡eƒ d!d"„ ƒƒZeƒ d#d$„ ƒZeƒ e e d¡d%d&„ ƒƒZeƒ e eo”e  ¡ d'kd(¡d)d*„ ƒƒZ!d+d,„ Z"d-d.„ Z#eƒ e e$ d¡d/d0„ ƒƒZ%eƒ e e& d¡d1d2„ ƒƒZ'eƒ e e( d¡d3d4„ ƒƒZ)eƒ d5d6„ ƒZ*d7d8„ Z+d9d:„ Z,erõd;d<„ Z-d=d>„ Z.d?d@„ Z/dAdB„ Z0dCdD„ Z1dES dES )FÚTestModuleFunctionsLeaksz&Test leaks of psutil module functions.c                 C   s   t ƒ }| | |j¡ d S r!   )r   r3   r¦   r6   r+   r+   r,   r8   T  s   z&TestModuleFunctionsLeaks.test_coveragec                 C   r­   )Nc                   S   ó   t jdd�S )NT©Úlogical©r^   Ú	cpu_countr+   r+   r+   r,   rT   \  rU   z9TestModuleFunctionsLeaks.test_cpu_count.<locals>.<lambda>r    r>   r+   r+   r,   Útest_cpu_countZ  r@   z'TestModuleFunctionsLeaks.test_cpu_countc                 C   r­   )Nc                   S   rÓ   )NFrÔ   rÖ   r+   r+   r+   r,   rT   `  rU   z?TestModuleFunctionsLeaks.test_cpu_count_cores.<locals>.<lambda>r    r>   r+   r+   r,   Útest_cpu_count_cores^  r@   z-TestModuleFunctionsLeaks.test_cpu_count_coresc                 C   ó   |   tj¡ d S r!   )r;   r^   r~   r>   r+   r+   r,   r   b  ó   z'TestModuleFunctionsLeaks.test_cpu_timesc                 C   r­   )Nc                   S   rÓ   )NT)Úpercpu)r^   r~   r+   r+   r+   r,   rT   h  rU   z=TestModuleFunctionsLeaks.test_per_cpu_times.<locals>.<lambda>r    r>   r+   r+   r,   Útest_per_cpu_timesf  r@   z+TestModuleFunctionsLeaks.test_per_cpu_timesc                 C   rÚ   r!   )r;   r^   Ú	cpu_statsr>   r+   r+   r,   Útest_cpu_statsj  rÛ   z'TestModuleFunctionsLeaks.test_cpu_statsrX   c                 C   rÚ   r!   )r;   r^   Úcpu_freqr>   r+   r+   r,   Útest_cpu_freqn  ó   z&TestModuleFunctionsLeaks.test_cpu_freqru   c                 C   s   t  ¡  |  t j¡ d S r!   )r^   Ú
getloadavgr;   r>   r+   r+   r,   Útest_getloadavgs  s   z(TestModuleFunctionsLeaks.test_getloadavgc                 C   rÚ   r!   )r;   r^   Úvirtual_memoryr>   r+   r+   r,   Útest_virtual_memoryz  ó   z,TestModuleFunctionsLeaks.test_virtual_memoryz&worthless on SUNOS (uses a subprocess)c                 C   rÚ   r!   )r;   r^   Úswap_memoryr>   r+   r+   r,   Útest_swap_memory~  rÛ   z)TestModuleFunctionsLeaks.test_swap_memoryc                 C   ó$   t rtn| j}| jdd„ |d� d S )Nc                   S   r®   r!   )r^   Ú
pid_existsre   rf   r+   r+   r+   r,   rT   „  r`   z:TestModuleFunctionsLeaks.test_pid_exists.<locals>.<lambda>rˆ   ©r   r$   r#   r;   rŠ   r+   r+   r,   Útest_pid_exists‚  rŒ   z(TestModuleFunctionsLeaks.test_pid_existsc                 C   rê   )Nc                   S   ó
   t  d¡S )NÚ.)r^   Ú
disk_usager+   r+   r+   r,   rT   Š  ó   
 z:TestModuleFunctionsLeaks.test_disk_usage.<locals>.<lambda>rˆ   rì   rŠ   r+   r+   r,   Útest_disk_usageˆ  rŒ   z(TestModuleFunctionsLeaks.test_disk_usagec                 C   rÚ   r!   )r;   r^   Údisk_partitionsr>   r+   r+   r,   Útest_disk_partitionsŒ  rç   z-TestModuleFunctionsLeaks.test_disk_partitionsz/proc/diskstatsz3/proc/diskstats not available on this Linux versionc                 C   r­   )Nc                   S   rÓ   ©NF)Únowrap)r^   Údisk_io_countersr+   r+   r+   r,   rT   “  rU   z@TestModuleFunctionsLeaks.test_disk_io_counters.<locals>.<lambda>r    r>   r+   r+   r,   Útest_disk_io_counters�  s   z.TestModuleFunctionsLeaks.test_disk_io_countersc                 C   rÚ   r!   )r;   r^   Úpidsr>   r+   r+   r,   Ú	test_pids—  rÛ   z"TestModuleFunctionsLeaks.test_pidsc                 C   r­   )Nc                   S   rÓ   rõ   )r^   Únet_io_countersr+   r+   r+   r,   rT      rU   z?TestModuleFunctionsLeaks.test_net_io_counters.<locals>.<lambda>r    r>   r+   r+   r,   Útest_net_io_counters�  rI   z-TestModuleFunctionsLeaks.test_net_io_countersr   zneed root accessc                 C   sF   t jdd� tƒ � |  dd„ ¡ W d   ƒ d S 1 sw   Y  d S )Nr¦   ©r©   c                   S   rÓ   )Nr¦   rý   )r^   Únet_connectionsr+   r+   r+   r,   rT   ¨  rU   z?TestModuleFunctionsLeaks.test_net_connections.<locals>.<lambda>)r^   rþ   r   r;   r>   r+   r+   r,   Útest_net_connections¢  s   "ÿz-TestModuleFunctionsLeaks.test_net_connectionsc                 C   s"   t rdn| j}| jtj|d� d S )Ni @ )Ú	tolerance)r   r   r;   r^   Únet_if_addrs)r%   r   r+   r+   r,   Útest_net_if_addrsª  s   z*TestModuleFunctionsLeaks.test_net_if_addrsc                 C   rÚ   r!   )r;   r^   Únet_if_statsr>   r+   r+   r,   Útest_net_if_stats¯  rç   z*TestModuleFunctionsLeaks.test_net_if_statsc                 C   rÚ   r!   )r;   r^   Úsensors_batteryr>   r+   r+   r,   Útest_sensors_battery´  râ   z-TestModuleFunctionsLeaks.test_sensors_batteryc                 C   rÚ   r!   )r;   r^   Úsensors_temperaturesr>   r+   r+   r,   Útest_sensors_temperatures¹  râ   z2TestModuleFunctionsLeaks.test_sensors_temperaturesc                 C   rÚ   r!   )r;   r^   Úsensors_fansr>   r+   r+   r,   Útest_sensors_fans¾  râ   z*TestModuleFunctionsLeaks.test_sensors_fansc                 C   rÚ   r!   )r;   r^   Ú	boot_timer>   r+   r+   r,   Útest_boot_timeÅ  rÛ   z'TestModuleFunctionsLeaks.test_boot_timec                 C   rÚ   r!   )r;   r^   Úusersr>   r+   r+   r,   Ú
test_usersÉ  rç   z#TestModuleFunctionsLeaks.test_usersc                 C   r­   )Nc                   S   rî   )NF)r^   Ú
_set_debugr+   r+   r+   r,   rT   Í  rñ   z9TestModuleFunctionsLeaks.test_set_debug.<locals>.<lambda>r    r>   r+   r+   r,   Útest_set_debugÌ  rP   z'TestModuleFunctionsLeaks.test_set_debugc                 C   rÚ   r!   )r;   rc   Úwinservice_enumerater>   r+   r+   r,   Útest_win_service_iterÓ  rç   z.TestModuleFunctionsLeaks.test_win_service_iterc                 C   s   d S r!   r+   r>   r+   r+   r,   Útest_win_service_getÖ  s   z-TestModuleFunctionsLeaks.test_win_service_getc                    ó&   t t ¡ ƒ ¡ ‰ |  ‡ fdd„¡ d S )Nc                      ó
   t  ˆ ¡S r!   )rc   Úwinservice_query_configr+   ©r=   r+   r,   rT   Û  rñ   zFTestModuleFunctionsLeaks.test_win_service_get_config.<locals>.<lambda>©Únextr^   Úwin_service_iterr=   r;   r>   r+   r  r,   Útest_win_service_get_configÙ  ó   z4TestModuleFunctionsLeaks.test_win_service_get_configc                    r  )Nc                      r  r!   )rc   Úwinservice_query_statusr+   r  r+   r,   rT   ß  rñ   zFTestModuleFunctionsLeaks.test_win_service_get_status.<locals>.<lambda>r  r>   r+   r  r,   Útest_win_service_get_statusÝ  r  z4TestModuleFunctionsLeaks.test_win_service_get_statusc                    r  )Nc                      r  r!   )rc   Úwinservice_query_descrr+   r  r+   r,   rT   ã  rñ   zKTestModuleFunctionsLeaks.test_win_service_get_description.<locals>.<lambda>r  r>   r+   r  r,   Ú test_win_service_get_descriptioná  r  z9TestModuleFunctionsLeaks.test_win_service_get_descriptionN)2r±   r²   r³   r´   r8   r1   rØ   rÙ   r   rÝ   rß   r   rµ   r   rá   r   rä   ræ   r   ré   rí   rò   rô   r   re   ÚpathÚexistsrø   rú   r   rü   r   Úgetuidrÿ   r  r  r   r  r   r  r   r
  r  r  r  r  r  r  r  r   r+   r+   r+   r,   rÒ   Q  sv    







ÿ

îrÒ   Ú__main__)Úrun_from_name)5r´   Ú
__future__r   r.   re   r^   Ú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   Ú_psplatformrc   rm   rV   r$   r1   r2   r¶   rµ   rÉ   rÒ   r±   Úpsutil.tests.runnerr%  Ú__file__r+   r+   r+   r,   Ú<module>   sd    76 
þ