Ë
    �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Ü+4�D—N‘NÔ(Ù˜tÐ5 dÒ5¨fÑ5à+1�D—N‘NÕ(á˜4Ð1 $Ò1¨&Ñ1Ð1øð ,2�D—N‘NÕ(ú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Ó$ˆØ
×Ñ˜t R§Z¡Z°"·*±*Ñ%<Õ=r2   c                 óN   — | j                  | j                  j                  «       y r$   )ÚexecuteÚprocÚname©r(   s    r-   Ú	test_namez TestProcessObjectLeaks.test_nameb   ó   € à�‰�T—Y‘Y—^‘^Õ$r2   c                 óN   — | j                  | j                  j                  «       y r$   )r?   r@   ÚcmdlinerB   s    r-   Útest_cmdlinez#TestProcessObjectLeaks.test_cmdlinef   ó   € à�‰�T—Y‘Y×&Ñ&Õ'r2   c                 óN   — | j                  | j                  j                  «       y r$   )r?   r@   ÚexerB   s    r-   Útest_exezTestProcessObjectLeaks.test_exej   ó   € à�‰�T—Y‘Y—]‘]Õ#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   ó   € ð 	�‰�T—Y‘Y—^‘^Õ$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|   ó   € à�‰�T—Y‘Y×%Ñ%Õ&r2   c                 óN   — | j                  | j                  j                  «       y r$   )r?   r@   ÚnicerB   s    r-   Ú	test_nicez TestProcessObjectLeaks.test_nice€   s   € Ø�‰�T—Y‘Y—^‘^Õ$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   ø€ ˜TŸY™YŸ^™^¨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´&×2JÑ2JÓ!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^   ù€ åÜ—O‘OÓ%ˆEØ�L‰LÔ8Õ9à�L‰LÓKÔLÜ×#Ñ#¤D×$8Ñ$8¼"¿)¹)»+ÀrÈ1ÓMˆCØ×Ñœw¨Õ,r2   c                 óN   — | j                  | j                  j                  «       y r$   )r?   r@   Úio_countersrB   s    r-   Útest_io_countersz'TestProcessObjectLeaks.test_io_counters•   ó   € ð 	�‰�T—Y‘Y×*Ñ*Õ+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-   € ô 	�‰Ó×!Ñ!Ô#Ø�‰�T—Y‘Y×'Ñ'Õ(r2   c                 óN   — | j                  | j                  j                  «       y r$   )r?   r@   Úcreate_timerB   s    r-   Útest_create_timez'TestProcessObjectLeaks.test_create_time    ó   € à�‰�T—Y‘Y×*Ñ*Õ+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­   ó   € ð 	�‰�T—Y‘Y×&Ñ&Õ'r2   c                 óN   — | j                  | j                  j                  «       y r$   )r?   r@   Únum_ctx_switchesrB   s    r-   Útest_num_ctx_switchesz,TestProcessObjectLeaks.test_num_ctx_switches²   ó   € à�‰�T—Y‘Y×/Ñ/Õ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   € à�‰�T—Y‘Y×(Ñ(Õ)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   € ð 	�‰�T—Y‘Y×'Ñ'Õ(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)   € Ý"•	¨¯
©
ˆØ�‰�T—Y‘Y×%Ñ%¨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   € à�‰�T—Y‘Y×+Ñ+Õ,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   ø€ ˜TŸY™Y×3Ñ3°HÓ=€ r2   c                  ó<   •— ‰ j                   j                  dg«      S ©Nrn   r²   rB   s   €r-   ra   z>TestProcessObjectLeaks.test_cpu_affinity_set.<locals>.<lambda>á   s   ø€ ¨t¯y©y×/EÑ/EÀrÀdÓ/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   € ä”*“, Ó$ñ 	/Ø�L‰L˜Ÿ™×-Ñ-Ô.÷	/÷ 	/ñ 	/ú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   ø€ ˜TŸY™Y×-Ñ-¬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   ø€ ˜TŸY™Y×-Ñ-¬f×.BÑ.BÀEÓJ€ r2   c                  ó:   •— ‰ j                   j                  d«      S rµ   )r@   rÃ   rB   s   €r-   ra   z8TestProcessObjectLeaks.test_rlimit_set.<locals>.<lambda>÷   s   ø€ ¸$¿)¹)×:JÑ:JÈ2Ó: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Ø×ÑœG¤ZÐ0Ó2NÕ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Ñ!6°tÓ!<€ r2   )r   r   r?   )r(   rÑ   s   `@r-   Útest_connectionsz'TestProcessObjectLeaks.test_connectionsù   s6   ù€ ô Óñ 	>Ý"‘6¨ˆDØ�L‰LÔ<Ô=÷	>÷ 	>ñ 	>ú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Ÿ^™^¬B¯I©I«KÓ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 )Ú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                 ó  •— 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*  ó   € Ø�L‰L˜Ÿ™Ÿ™Õ(r2   c                 óN   — | j                  | j                  j                  «       y r$   )r?   r@   r   rB   s    r-   Útest_terminatez)TestTerminatedProcessLeaks.test_terminate-  s   € Ø�L‰L˜Ÿ™×,Ñ,Õ-r2   c                 óN   — | j                  | j                  j                  «       y r$   )r?   r@   ÚsuspendrB   s    r-   Útest_suspendz'TestTerminatedProcessLeaks.test_suspend0  s   € Ø�L‰L˜Ÿ™×*Ñ*Õ+r2   c                 óN   — | j                  | j                  j                  «       y r$   )r?   r@   r§   rB   s    r-   r©   z&TestTerminatedProcessLeaks.test_resume3  s   € Ø�L‰L˜Ÿ™×)Ñ)Õ*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   ø€ ôð �L‰L˜Õ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×.Ñ.¬r¯y©y«{À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×.Ñ.¬r¯y©y«{À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   € ÜÓˆØ
×Ñ˜t R§V¡VÕ,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×.Ñ.¬r¯y©y«{Ó;€ 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    € Ý"•	¨¯
©
ˆØ�‰Ñ3¸5ˆÕ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Ñ4¸EÔ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Ñ3¸5Ô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Ñ!7¸UÔ!C€ r2   )rl   rJ  r   r?   rB   s    r-   Útest_net_connectionsz-TestModuleFunctionsLeaks.test_net_connections©  s>   € ô 	×Ñ EÕ*ÜÓñ 	EØ�L‰LÑ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%   € å!(‘I¨d¯n©nˆ	Ø�‰”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   € Ø�L‰Lœ×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Ó9ˆDØ�L‰LÓ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Ó9ˆDØ�L‰LÓ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‡_�_ØÒ7�b—g‘g—n‘nÐ%6Ó7Ð7Ø=óñ ÓñDó ó	ð
Dñ
 Óñ"ó ð"ñ
 ÓØ€X‡_�_Ð,Ð,¨oÓ>ñCó ?ó ðCñ ÓØ€X‡_�_�UÒ/˜y˜rŸy™y›{¨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   