gf dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddl m Z ddl mZddl mZddl mZddl mZdd l mZdd l mZdd l mZdd l mZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddlm%Z%ddlm&Z&ddlm'Z'ddlm(Z(ddlm)Z)ddlm*Z*dd lm+Z+dd!lm,Z,dd"lm-Z-dd#lm.Z.Gd$d%e)Z/Gd&d'e)Z0Gd(d)e)Z1Gd*d+e)Z2Gd,d-e)Z3Gd.d/e)Z4Gd0d1e)Z5e6d2krdd3l7m8Z8e8e9dSdS)4zTests for system APIS.N)AIX)BSD)FREEBSD)LINUX)MACOS)NETBSD)OPENBSD)POSIX)SUNOS)WINDOWS)FileNotFoundError)long)ASCII_FS)check_net_address) CI_TESTING)DEVNULL)enum)GLOBAL_TIMEOUT) HAS_BATTERY) HAS_CPU_FREQ)HAS_GETLOADAVG)HAS_NET_IO_COUNTERS)HAS_SENSORS_BATTERY)HAS_SENSORS_FANS)HAS_SENSORS_TEMPERATURES)IS_64BIT)mock)PsutilTestCase)PYPY)retry_on_failure)GITHUB_ACTIONS)UNICODE_SUFFIX)unittestceZdZdZdZejeoeddZ ejeoeddZ dZ dZ dS) TestProcessAPIsch|tjdtjD|}||jdtjDtj|j}|| | |jdtjDtj dtj tj5|ttjgdddn #1swxYwYtj dtjtj5|tj5ttjdddn #1swxYwYddddS#1swxYwYdS)Ncg|] }|j Spid.0xs z/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib64/python3.11/site-packages/psutil/tests/test_system.py z5TestProcessAPIs.test_process_iter..@s#I#I#IaAE#I#I#Icg|] }|j Sr(r)r+s r.r/z5TestProcessAPIs.test_process_iter..Bs!G!G!GA!%!G!G!Gr0cg|] }|j Sr(r)r+s r.r/z5TestProcessAPIs.test_process_iter..Fs$J$J$JqQU$J$J$Jr0zpsutil.Process side_effect)assertInosgetpidpsutil process_iterspawn_testprocr*Processkillwait assertNotInrpatch NoSuchProcess assertEquallist AccessDenied assertRaisesselfsprocps r.test_process_iterz!TestProcessAPIs.test_process_iter?s bikk#I#I63F3H3H#I#I#IJJJ##%% ei!G!G1D1F1F!G!G!GHHH N59 % %   $J$JF4G4I4I$J$J$JKKK Z($*$8$E$EGGG > >   T&"5"7"788" = = = > > > > > > > > > > > > > > >Z($*$7 $D$DFFF , ,""6#677 , ,V(**+++ , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,sH=5E>>FF H'"!H H'H H'H H''H+.H+ctjdgD]=}|t|jdg>|t5ttjdgdddn #1swxYwYtj dtj dd5}tjddgD]C}| |jd| |jddD|j sJ dddn #1swxYwYtj dtj dd5}t}tjddg| D]D}||jd|| |jddE|j sJ ddddS#1swxYwYdS) Nr*)attrsfooz$psutil._psplatform.Process.cpu_timesrr3 cpu_times)rKad_value)r8r9rArBinfokeysrD ValueErrorrr?rC assertIsNoneassertGreaterEqualcalledobjectassertIs)rFrHmflags r.test_prcess_iter_w_attrsz(TestProcessAPIs.test_prcess_iter_w_attrsPs$E7333 ; ;A   T!&++--005' : : : :   z * * 5 5 $E7333 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 Z>$*$72$>$>@@@ CD({/CDDD : :!!!&"5666''u q99998OO8O                 Z>$*$72$>$>@@@ CD88D( +.??? : : af[14888''u q99998OO8O                  s8/$BB#&B#A%EE  E 9A5G<<HHz-spawn_testproc() unreliable on PYPY + WINDOWSc fd}g }}}d|||fD}ttj|dt tj|dt j}tj|d|\}}t j|z d |gt|d  g|D]%} t| d &td fd } | | ||\}}|jd|Dt r9|jt&j n-|jd |jg|D]%} t| d &td fd} | | | ||\}}t+ t+|j|j|jg|D]%} t| d &dS)Nc<|jdSN)appendr*)rHpidss r.callbackz1TestProcessAPIs.test_wait_procs..callbackgs KK     r0c@g|]}tj|jSr(r8r;r*r+s r.r/z3TestProcessAPIs.test_wait_procs..n$III1&&IIIr0)timeout)r`g{Gz?rer`g? returncodectj|d|\}}t|dt|d||fS)NQ?rgrfr8 wait_procsrAlenprocsr`gonealiverFs r.testz-TestProcessAPIs.test_wait_procs..test{g +E45=???KD%   SYY * * *   SZZ + + +; r0cg|] }|j Sr(r)r+s r.r/z3TestProcessAPIs.test_wait_procs..s"7"7"7Q15"7"7"7r0ctj|d|\}}t|dt|d||fS)Nrlrgrhrrnrqs r.ruz-TestProcessAPIs.test_wait_procs..testrvr0)r:rDrRr8ro TypeErrortime assertLessrArp assertFalsehasattrr terminater5r*r poprisignalSIGTERMset assertTrue) rFr`sproc1sproc2sproc3rrtrsrtrHrur_s ` @r.test_wait_procszTestProcessAPIs.test_wait_procsdsR     $$&&$$&&$$&&II0HIII *f&7KKK )V%6JJJ IKK'thOOO e  a--- r""" UQ''' r""" 7 7A   WQ 55 6 6 6 6 "          d5(++ e fj"7"7$"7"7"7888  7   TXXZZ2V^O D D D D   TXXZZ2A 6 6 6  |,,, 7 7A   WQ 55 6 6 6 6 "          d5(++ e TCVZ(L$M$MNNN 6 6A OOGA|44 5 5 5 5 6 6r0c|}|}|}d|||fD}|D]}|tj|\}}dS)Nc@g|]}tj|jSr(rbr+s r.r/z>TestProcessAPIs.test_wait_procs_no_timeout..rcr0)r:r~r8ro)rFrrrrrrHrsrts r.test_wait_procs_no_timeoutz*TestProcessAPIs.test_wait_procs_no_timeouts$$&&$$&&$$&&II0HIII  A KKMMMM'.. eeer0c$|}|tj|jtj|j}|||tj|j|tjd| tjddtj vdS)Nrdr) r:rr8 pid_existsr*r;r<r=r|rAr_rEs r.test_pid_existszTestProcessAPIs.test_pid_existss##%% )%)44555 N59 % %   *5955666 *2../// *1--qFKMM/ABBBBBr0ctj}|D]g} tj|sJ#t$rAt jd|tjvr||YdwxYwtt|dzt|dz}|D]+}| tj||,dS)Ng?iipmsg) r8r_rAssertionErrorrzsleepfailrangemaxr|)rFr_r*s r.test_pid_exists_2z!TestProcessAPIs.test_pid_exists_2s{}} # #C #(------! # # # 2&+--''IIcNNN  # SYY%s4yy4'788 > >C   V.s33  = = = = > >s0AA;:A;N) __name__ __module__ __qualname__rIrZr#skipIfrr rrrrr(r0r.r%r%=s,,,"(X_T%gDFF5656FF56nX_T%gDFF//FF/CCC > > > > >r0r%cteZdZdZejeoej ddZ dZ dZ dS) TestMiscAPIsctj}||t||d||t jdSNr)r8 boot_timeassertIsInstancefloat assertGreaterr{rz)rFbts r.test_boot_timezTestMiscAPIs.test_boot_times\     b%((( 2q!!! DIKK(((((r0unreliable on CIctj}||g|D]#}|js J|||jt ||jt tdf|j/||jt tdf|j|j|j dks J|tj |j tstr||j tj|j%dS)N)r8usersassertNotEqualnamerstrterminaltypehoststarteddatetime fromtimestampr r rSr*r;)rFrusers r. test_userszTestMiscAPIs.test_userss6  E2&&& ) )D9 " "d " "9  ! !$)S 1 1 1  ! !$-#tDzz1B C C Cy$%%di#tDzz1BCCC MM II<#%%%t%%%   + +DL 9 9 9 )' )!!$(++++tx(((( ) )r0ctj}tt_ tj|t_dS#|t_wxYwr])sysstdoutrr8ru)rFrs r. test_testzTestMiscAPIs.test_tests>  KMMMCJJJCJ    s AAc2gd}|D]2}|tt|t|3tjdkrtjsJtjrJ|ddtj vr%tj sJ|dndtj vrtj sJ|tjtjtjgdd |d |d |d |d ndtj vs dtj vr$tjsJ|dnudtj vr#tjsJ|dn1tjsJtjrJ|d|D]-}|tt|d|.dS)N) r r rrrr rrr rposixr linuxrbsdTrfrrr rsunossolarisr darwinrr F)rgetattrr8boolr6rr r removerplatformlowerrrrArr rcountr rrW)rFnamesrs r.test_os_constantszTestMiscAPIs.test_os_constantssj+++ I ID  ! !'&$"7"74 ! H H H H 7g  <  <~ % %% LL ! ! !#,,,....|##| W%%%%#,,,....z!!z  &.&."(-"116taAAA U### Y''' Y''' X&&&&CL..0000!3!3!5!555|##| W%%%%S\//1111|##| W%%%> ! !>| # ## LL # # # B BD MM'&$//DM A A A A B Br0N) rrrrr#rrr8rrrrr(r0r.rrs))) X_Z6  $68JKK))LK)$   #B#B#B#B#Br0rceZdZdZdZdS)TestMemoryAPIsc Dtj}|jdks J||jdks J|d|jcxkrdks nJ||jdks J||jdks J||jD]}t||}|dkr"| |ttf|dkrR|dks| |d|d||jkr&| |d|jd|d |ddS) Nrdpercenttotalz < 0 ()z > total (total=z, =) r8virtual_memoryr availablerusedfree_fieldsrrintrr)rFmemrvalues r.test_virtual_memoryz"TestMemoryAPIs.test_virtual_memorysd#%%y1}}}c}}}}q   #   CK&&&&3&&&&&&&&x!|||S|||x1}}}c}}}K @ @DC&&Ey  %%ec4[999wzzIItttUUU;<<<39$$II!%syyy$$$?@@@ @ @r0ctj}||jd|jdks J||jdks J||jdkr|jdks J|n|jdks J|d|jcxkrdks nJ||jdks J||j dks J|dS)N)rrrrsinsoutrr) r8 swap_memoryrArrrrrrr)rFrs r.test_swap_memoryzTestMemoryAPIs.test_swap_memory s ""  KL N N NyA~~~s~~~x1}}}c}}} 9q==8a<<<<<<<8q===#===CK&&&&3&&&&&&&&w!|||S|||x1}}}c}}}}}r0N)rrrrrr(r0r.rr s5@@@$"""""r0rceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZeje ddZeje ddZdS) TestCpuAPIsctj}||||t tjd||dtj drStd5}| }dddn #1swxYwYd|vrtj ddSdS)NTpercpurfz /proc/cpuinfoz physical idz#cpuinfo doesn't include physical id)r8 cpu_countassertIsNotNonerArprNrTr6pathexistsopenreadr#SkipTest)rFlogicalfd cpuinfo_datas r.test_cpu_count_logicalz"TestCpuAPIs.test_cpu_count_logical3s"$$ W%%% #f&6d&C&C&C"D"DEEE +++ 7>>/ * * Oo&& )"!wwyy  ) ) ) ) ) ) ) ) ) ) ) ) ) ) )L00'(MNNN  O O10s#CC CcVtj}tjd}||dtr6t jdddkr||dS||d|||dS)NFrzphysical cpu_count() is Nonerm)rfrf)r8rskipTestr rgetwindowsversionrSrT)rFrphysicals r.test_cpu_count_physicalz#TestCpuAPIs.test_cpu_count_physical?s"$$#E222  -- >?? ?  7s,..rr2f<<   h ' ' ' ' '  # #Ha 0 0 0  # #GX 6 6 6 6 6r0cdD]}tjd|5}|tj|jsJ dddn #1swxYwYtjd|5}|tjd|jsJ dddn #1swxYwYdS)N)rdrNz$psutil._psplatform.cpu_count_logical return_valuez%psutil._psplatform.cpu_count_physicalFr)rr?rSr8rrU)rFvalrXs r.test_cpu_count_nonezTestCpuAPIs.test_cpu_count_noneJsW   CB),... 12!!&"2"4"4555xx               C),... 12!!&"25"A"A"ABBBxx                 s#0AA A 92B88B< ?B< c(d}tj}t||D]8}||t||d||z }9||t|t|dS)Nrr)r8rNsumrrrTrAr)rFrtimescp_times r.test_cpu_timeszTestCpuAPIs.test_cpu_timesVs "" E   G  ! !'5 1 1 1  # #GS 1 1 1 W EE E +++ E r0cRttj}tjtz}tj|kr?ttj}||krdStj|k?|ddS)Nztime remained the same)rr8rNrzrr)rFt1stop_att2s r.test_cpu_times_time_increasesz)TestCpuAPIs.test_cpu_times_time_increasesss !## $ $)++.ikkG##V%''((BBwwikkG## *+++++r0ctjdD]}d}t||D]8}||t||d||z }9||t|t||ttjddttjddS)NTrrrF) r8rNrrrrTrArrp)rFrrrs r.test_per_cpu_timeszTestCpuAPIs.test_per_cpu_times}s%T222  EE JJJ  ! !%%gu555''555    UCJJ / / / JJJJ V-T:::1=>>V-U;;;<< > > > > >r0ctjd}tjtz} tj|kr|dStjd}t ||D];\}}tj|tj|}}||z }|dkrdS<)NTrreg?)r8rNrzrrzip_cpu_busy_time)rFtot1 giveup_attot2rr differences r.test_per_cpu_times_2z TestCpuAPIs.test_per_cpu_times_2st,,,IKK.0  y{{i''yy+++#4000DdD//  B.r22F4I"4M4MB"W %%FF& r0ctj}tjd}|dt|D}|jD]6}|t ||t ||d7dS)NTrc,g|]}t|Sr()r)r,nums r.r/z9TestCpuAPIs.test_cpu_times_comparison..s#F#F#FCHH#F#F#Fr0rfdelta)r8rN_makerrassertAlmostEqualr)rFbaseper_cpu summed_valuesfields r.test_cpu_times_comparisonz%TestCpuAPIs.test_cpu_times_comparisons!!"$/// #F#FW #F#F#FGG \ N NE  " "e$$gmU&C&C1 # N N N N N Nr0c  ||t||d||d||dt jzdS#t$rA}td|dtj |dtj |d}~wwxYw)NrggY@ z last=z new=) rrrT assertIsNotassertLessEqualr8rrpprintpformat)rFrlast_retnew_reterrs r._test_cpu_percentzTestCpuAPIs._test_cpu_percents I  ! !'5 1 1 1  # #GS 1 1 1   Wd + + +  %&2B2D2D*D E E E E E I I I .V^H----v~g/F/F/F"HII I IsA1A55 C?>> TF$4$6$6777s  A$d4@@@C ; ;&&wc::::DD   z * * 9 9  4 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9s+CCCctjd}tdD]Y}tjd}|D]}|||||t ||||}Z|t 5tjdddddS#1swxYwYdSr%)r8cpu_times_percentrr#rrDrRr.s r.test_cpu_times_percentz"TestCpuAPIs.test_cpu_times_percents'777s  A*D999C ; ;&&wc::::  " "3s88T3 7 7 7DD   z * * 2 2  $b 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2sB<<CCcxtjdd}|t|tjt dD]_}tjdd}|D]B}|D]}|||||t|||C|}`dS)Nr&Tr-r)r8r1rArprrr#r)rFr)r-r*cpurs r.test_per_cpu_times_percentz&TestCpuAPIs.test_per_cpu_times_percents'tDDD TF$4$6$6777s  A*DFFFC < <"??G**7D#>>>>&&s3xxs;;;;DD   r0c6tjddtjdD}tjd|5tjdD]}|D]}||dd ddddS#1swxYwYdS)NTrc g|]@}|dtt|jDAS)cg|]}dS)rr(r+s r.r/zNTestCpuAPIs.test_per_cpu_times_percent_negative...s@@@Qq@@@r0)rrrprr+s r.r/zCTestCpuAPIs.test_per_cpu_times_percent_negative..sS>>>gg@@%AI*?*?@@@AA>>>r0zpsutil.cpu_timesr)r8r1rNrr?r#)rF zero_timesr4rs r.#test_per_cpu_times_percent_negativez/TestCpuAPIs.test_per_cpu_times_percent_negatives' ---->>%/t<<<>>> Z* D D D @ @/t<<< @ @"@@G**7D$????@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @s 5BBBctj}||jd|jD]I}t ||}||dt s|dvr||dJdS)N) ctx_switches interruptssoft_interruptssyscallsr)r<r=)r8 cpu_statsrArrrTrr)rFinfosrrs r.test_cpu_statszTestCpuAPIs.test_cpu_statss ""  M I K K KM - -DE4((E  # #E1 - - - -4#AAA""5!,,,  - -r0z not suportedcHfd}tjd}tr|sd|s J||tjdgtr6t |tjdSdS)NcN|D]}|jd|jdkr |j|j|jD]P}t ||}|tttf |dQdS)N)currentminrrr) rArrrrErrrrrrT)lsntrrrFs r.check_lsz+TestCpuAPIs.test_cpu_freq..check_lss 6 6  -FGGG6S==((RV<<<J66D#B--E))%#tU1CDDD++E155556  6 6r0Trzreturns empty list on FreeBSDF)r8cpu_freqrrrrArpr)rFrIrGs` r. test_cpu_freqzTestCpuAPIs.test_cpu_freqs 6 6 6 6 6_D ) ) )  A2 A-- ?@@ @ 2 r&////0111  :   SWWf&6&8&8 9 9 9 9 9 : :r0 not supportedctj}|t|d|D]3}||t ||d4dS)Nrhr)r8 getloadavgrArprrrT)rFloadavgloads r.test_getloadavgzTestCpuAPIs.test_getloadavgst#%% Wq))) / /D  ! !$ . . .  # #D# . . . . / /r0N)rrrrrrrrrr rr#r+r/r2r5r:rBr#rrrKrrQr(r0r.rr1s\ O O O 7 7 7       :,,, > > >B   NNNIII,,, 9 9 9 2 2 2   @@@ - - -X_%~66::76:*X_'99//:9///r0rcHeZdZejeoe ddZeje ddZ dZ dZ eje oe jd dejeoej d d Zd Zd S) TestDiskAPIszunreliable on PYPY32 + 32BITctjtj}||jd|jdks J||jdks J||jdks J||j|jks J||j|jks J|d|j cxkrdksnJ|j ttdrtjtj}d}||j|j| |j|j|| |j|j|| }|t5tj|ddddS#1swxYwYdS)N)rrrrrr disk_usageiPr)r8rUr6getcwdrArrrrrr}shutilr get_testfnrDr )rFusage shutil_usage tolerancefnames r.test_disk_usagezTestDiskAPIs.test_disk_usage#s!")++.. (LMMM{QzA~~~u~~~zA~~~u~~~{UZ''''''{UZ''''''EM((((S(((((%-((( 6< ( ( 4!,RY[[99L'I   U[,*< = = =  " "5:|/@)2 # 4 4 4  " "5:|/@)2 # 4 4 4 !!   0 1 1 % %  e $ $ $ % % % % % % % % % % % % % % % % % %s%GG G znot an ASCII fsc|t5tjtddddS#1swxYwYdSr])rDUnicodeEncodeErrorr8rUr"rFs r.test_disk_usage_unicodez$TestDiskAPIs.test_disk_usage_unicode>s  1 2 2 . .  n - - - . . . . . . . . . . . . . . . . . .sAA Ac.tjddS)N.)r8rUr`s r.test_disk_usage_bytesz"TestDiskAPIs.test_disk_usage_bytesDs$r0c>fd}tjd}|||D]}||tr d|jvrt s/t j|j s J|n|j t j|j s J||j s J|tjd}||tjdD]}||ts|j r t j |j t j|j s J|d#t$rR}tr!tr|jt jkrYd}~|jt jt jfvrYd}~d}~wwxYwd}|t(}dtjdD}||dS) Nc^|jt|jt|jt|jt|jttdf|j ttdf|j"ts |jd|j  |j ddSdSr) rdevicer mountpointfstypeoptsmaxfilerrmaxpathr!rrHrFs r. check_ntuplez7TestDiskAPIs.test_disk_partitions..check_ntupleHs  ! !")S 1 1 1  ! !"- 5 5 5  ! !")S 1 1 1  ! !"'3 / / /  ! !"*sDJJ.? @ @ @  ! !"*sDJJ.? @ @ @z%n%""2:q111z%""2:q11111&%r0F)allrcdromTc"tj|}tj|s>tj|}tj|>|Sr])r6rabspathismountdirnamer)rs r.find_mount_pointz;TestDiskAPIs.test_disk_partitions..find_mount_pointysd7??4((Dgood++ -wt,,good++ -::<< r0cNg|]"}|j |j#Sr()rhrr+s r.r/z5TestDiskAPIs.test_disk_partitions..sCDDD167lD!,$$&&DDDr0)r8disk_partitionsrr rjr r6rrrgrhristatOSErrorr!rerrnoEIOEPERMEACCES__file__r5)rFrnrGdiskr"rumountmountss` r.test_disk_partitionsz!TestDiskAPIs.test_disk_partitionsGs 2 2 2 2 2 # . . . ### % %D L    7di// w~~dk2288D8828 7>>$/22 8 8D 8 82; $ $ $ $; $ # - - - ###*t444 A AD L    At A AGDO,,,7>>$/::@@D@@:@%!%!CI4J4J yel(CCCDCCCC    ! **DD(T222DDD eV$$$$$s-E55 G?#G ' G  Gz/proc/diskstatsz3/proc/diskstats not available on this linux versionrcRfd}tjd}| Jd||tjd}t|tt ||D]}|s J|||| dS)Nc&|d|j|d|j|d|j|d|jt st sՉ|d|j|d|jtrd|d|j |d|j |d |j n(tr!|d|j |jD] }t||dks J|!dS) Nrrfrmrhr)rA read_count write_count read_bytes write_bytesr r read_time write_timerread_merged_countwrite_merged_count busy_timerrr)rHrrFs r.rnz8TestDiskAPIs.test_disk_io_counters..check_ntuples   RUBM 2 2 2   RUBN 3 3 3   RUBM 2 2 2   RUBN 3 3 3 :v :  A 555  A 666:$$RUB,@AAA$$RUB,ABBB$$RUBL9999:$$RUBL999  2 2r4((A---r---- 2 2r0Fperdiskzno disks on this system?T)r8disk_io_countersrArprrFrnretkeys` r.test_disk_io_countersz"TestDiskAPIs.test_disk_io_counterss  2 2 2 2 2"%e444 : S%d333 S3s3xx==111 # #COOOO3 LS " " " " # #r0ctjdi5}|tjd|tjdi|jsJ ddddS#1swxYwYdS)Nz#psutil._psplatform.disk_io_countersrFrT)rr?rSr8rrArUrFrXs r.test_disk_io_counters_no_disksz+TestDiskAPIs.test_disk_io_counters_no_diskssZ=%'))) ,-   f5eDDD E E E   V4TBBBB G G G8OO8O                   ABBBN)rrrr#rrrr]rrardrrr6rrrr8rrrr(r0r.rSrS!s X_T*(l,JKK%%LK%4X_\#455..65.    ;%;%;%zX_UD27>>2C#D#DDJLLX_ZA(?(?(A(A$A'))##))LL#8r0rSceZdZeje ddZeje ddZdZdZ dZ eje pe pe ddZd S) TestNetAPIsrLc4fd}tjd}||tjd}|g|D]C}||t |||DdS)Nch|d|j|d|j|d|j|d|j|d|j|d|j|d|j|d|j|jdks J||jdks J||jdks J||jdks J||jdks J||jdks J||jdks J||jdks J|dS) Nrrfrmrhrrrr) rA bytes_sent bytes_recv packets_sent packets_recverrinerroutdropindropoutrms r.rnz6TestNetAPIs.test_net_io_counters..check_ntuples   RUBM 2 2 2   RUBM 2 2 2   RUBO 4 4 4   RUBO 4 4 4   RUBH - - -   RUBI . . .   RUBI . . .   RUBJ / / /=A%%%r%%%=A%%%r%%%?a''''''?a''''''8q==="===9>>>2>>>9>>>2>>>:???B?????r0FpernicT)r8net_io_countersrrrrrs` r.test_net_io_countersz TestNetAPIs.test_net_io_counterss ' ' ' ' '$$E222 S$D111 C$$$ # #C OOC  ! !#s + + + LS " " " " # #r0ctjdi5}|tjd|tjdi|jsJ ddddS#1swxYwYdS)Nz"psutil._psplatform.net_io_countersrFrT)rr?rSr8rrArUrs r.test_net_io_counters_no_nicsz(TestNetAPIs.test_net_io_counters_no_nicssZ<%'))) ,-   f4EBBB C C C   V34@@@" E E E8OO8O                   rc tj}|s J|tj}ttjtjtjg}|D]"\}}| |t| tt|t||D]}| |j t| |jt| |jtt#df| |jtt#df||j |t(jdkr,t,s%| |j t.j||jr-|j tjkrbt j|j }t5j|5||jdfdddn #1swxYwYn|j tjkrt j|jdtjtjdtjd}|\} } } } } t j| | | }t5j|5|| dddn #1swxYwY|j|j|j|j fD].}|*|j tjkrtC||j /|jr|"|j |j r|"|j$tFstHstJrCtMtdr,| tjtjdSdStNr,| tjtj(dStRr"| tjddSdS)N)rhrrAF_LINKrd)*r8 net_if_addrs net_if_statsrsocketAF_INETAF_INET6ritemsrrrArpfamilyraddressnetmaskr broadcastr5r version_inforrIntEnumisup contextlibclosingbind getaddrinfo SOCK_STREAM AI_PASSIVEptprrSrrr r}r AF_PACKETr )rFnics nic_statsfamiliesnicaddrsaddrsrPafsocktypeproto canonnamesaips r.test_net_if_addrszTestNetAPIs.test_net_if_addrssE"$$Tt')) HII**,,& 6& 6JC  ! !#s + + +   SU__c%jj 9 9 9# 6# 6%%dk3777%%dlC888%%dlS$t**4EFFF%%dnsDJJ6GHHH dk8444#v--d-))$+t|DDDS>&'{fn44"M$+66'/2266FFDL!#455566666666666666677%1 L!V_".63D F FFG I>B:HeY"M"h>>'/22''FF2JJJ'''''''''''''''<t~8%??B~ ;&/99-b$+>>>>6%%dh////X6%%dn555G# 6J  1% 15 1vy)) A  @@@@@ A A  1   V^V-= > > > > >  1   V^R 0 0 0 0 0 1 1s$II I K??L L cltrdtjddddfg}ndg}tjd|5}tjdd}|jsJtr||jdn||jdddddS#1swxYwYdS) Nem1z06:3d:29)rrdz06-3d-29NNNzpsutil._psplatform.net_if_addrsrrz06:3d:29:00:00:00z06-3d-29-00-00-00) r r8rrr?rrUrAr)rFrrXrs r. test_net_if_addrs_mac_null_bytesz,TestNetAPIs.test_net_if_addrs_mac_null_bytess   >6>:tT4HICC<=C Z9%(*** D-.&((/2D8OO8 D  /BCCCC  /BCCC D D D D D D D D D D D D D D D D D DsA'B))B-0B-ctj}|s J|tjtjtjf}|D]\}}||t|\}}}}||t| ||| ||| |d| |ddSr) r8rNIC_DUPLEX_FULLNIC_DUPLEX_HALFNIC_DUPLEX_UNKNOWNrrrrr5rT) rFr all_duplexesrstatsrduplexspeedmtus r.test_net_if_statszTestNetAPIs.test_net_if_stats$s"$$Tt..13  ::<< , ,KD%  ! !$ , , ,', $D&%  ! !$ - - - MM&, / / / MM&, / / /  # #E1 - - -  # #C + + + + , ,r0zLINUX or BSD or MACOS specificctjdttjd5}t j}||i|jsJ ddddS#1swxYwYdS)Nzpsutil._psutil_posix.net_if_mturMr3) rr?ryrzENODEVr8rrArU)rFrXrs r.test_net_if_stats_enodevz$TestNetAPIs.test_net_if_stats_enodev3sZ9$+EL"$=$=??? BC%''C   S" % % %8OO8O                   s3A00A47A4N)rrrr#rrrrrrrrrrrr(r0r.rrsX_,,o>>##?>#8X_,,o>>?>:1:1:1xDDD" , , ,X_%/3/%057777r0rceZdZeje ddZeje ddZeje deje ddZ eje ddZ dS)TestSensorsAPIsrLctj}|D]\}}||t|D]}||jt|j||jd|j||jd|j ||j ddSr) r8sensors_temperaturesrrrlabelrErThighcritical)rFtempsrentriesentrys r.test_sensors_temperaturesz)TestSensorsAPIs.test_sensors_temperatures@s+--"[[]] ? ?MD'  ! !$ , , ,  ? ?%%ek3777=,++EM1===:)++EJ:::>-++ENA>>> ? ? ?r0cdddgi}tjd|5}tjddd}|jsJ||jd||jd ||jd ddddS#1swxYwYdS) Ncoretemp)rgI@gN@gQ@z'psutil._psplatform.sensors_temperaturesrT) fahrenheitrg^@ga@gc@) rr?r8rrUrArErr)rFdrXrs r.#test_sensors_temperatures_fahreneitz3TestSensorsAPIs.test_sensors_temperatures_fahreneitNs  56 7 ZA%&((( 4+,/!!!!+--.0E8OO8   U]E 2 2 2   UZ / / /   U^U 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4sAsX_11?CC ? ?DC ?X_11?CC 4 4DC 4X_,,o>>X__l33 7 743?> 7X_))?;;::<;:::r0r__main__) run_from_name):__doc__rrrzr6rrWrrrrzr8rrrrrrr r r r psutil._compatr r psutil.testsrrrrrrrrrrrrrrrrrr r!r"r#r%rrrrSrrrpsutil.tests.runnerrr~r(r0r.rs_ ,,,,,,!!!!!!******###### ''''''$$$$$$%%%%%%'''''',,,,,,,,,,,,))))))111111!!!!!!''''''))))))''''''''''''!!!!!!B>B>B>B>B>nB>B>B>JGBGBGBGBGB>GBGBGBT""""""""""^""""""Jm/m/m/m/m/.m/m/m/`JJJJJ>JJJZMMMMM.MMM`2:2:2:2:2:n2:2:2:j z111111M(r0