[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@13.59.130.154: ~ $
U

�=�_��@szdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlmZddlm
Z
ddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
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%�d%e)�Z/Gd&d'�d'e)�Z0Gd(d)�d)e)�Z1Gd*d+�d+e)�Z2Gd,d-�d-e)�Z3Gd.d/�d/e)�Z4Gd0d1�d1e)�Z5e6d2k�rvdd3l7m8Z8e8e9�dS)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)�unittestc@s\eZdZdd�Zdd�Ze�eo"ed�dd��Z	e�eo:ed�dd	��Z
d
d�Zdd
�ZdS)�TestProcessAPIsc
Cs�|�t��dd�t��D��|��}|�|jdd�t��D��t�|j�}|��|�	�|�
|jdd�t��D��tjdt�
t���d��|�tt���g�W5QRXtjdt�t���d��*|�tj��tt���W5QRXW5QRXdS)NcSsg|]
}|j�qS���pid��.0�xr$r$�K/opt/alt/python38/lib64/python3.8/site-packages/psutil/tests/test_system.py�
<listcomp>@sz5TestProcessAPIs.test_process_iter.<locals>.<listcomp>cSsg|]
}|j�qSr$r%r'r$r$r*r+BscSsg|]
}|j�qSr$r%r'r$r$r*r+Fszpsutil.Process�Zside_effect)�assertIn�os�getpid�psutil�process_iter�spawn_testprocr&�Process�kill�waitZassertNotInr�patchZ
NoSuchProcess�assertEqual�list�AccessDenied�assertRaises��selfZsproc�pr$r$r*�test_process_iter?s ��z!TestProcessAPIs.test_process_iterc	Cs,tjdgd�D]}|�t|j���dg�q|�t��ttjdgd��W5QRXtj	dt�
dd�d��H}tjddgd�D]&}|�|jd�|�|jdd�q||j
s�t�W5QRXtj	dt�
dd�d��T}t�}tjddg|d	�D](}|�|jd|�|�|jdd�q�|j
�st�W5QRXdS)
Nr&)�attrsZfooz$psutil._psplatform.Process.cpu_timesr�r,�	cpu_times)r?Zad_value)r0r1r7r8�info�keysr:�
ValueErrorrr6r9�assertIsNone�assertGreaterEqual�called�AssertionError�object�assertIs)r<r=�m�flagr$r$r*�test_prcess_iter_w_attrsPs0
�
��
z(TestProcessAPIs.test_prcess_iter_w_attrsz-spawn_testproc() unreliable on PYPY + WINDOWScs��fdd�}g����}���}���}dd�|||fD�}�jttj|dd��jttj|dd�t��}tj|d	|d
�\}}��t��|d���|g���t	|�d����g�|D]}	��
t|	d
��q�td��fdd��}
|�
�|
||�\}}��|jdd�|D��t�r6��|��jtj�n��|��jd����|jg�|D]}	��
t|	d
���q\td��fdd��}
|�
�|�
�|
||�\}}��t��t|j|j|jg��|D]}	��t|	d
���q�dS)Ncs��|j�dS�N)�appendr&)r=)�pidsr$r*�callbackgsz1TestProcessAPIs.test_wait_procs.<locals>.callbackcSsg|]}t�|j��qSr$�r0r3r&r'r$r$r*r+nsz3TestProcessAPIs.test_wait_procs.<locals>.<listcomp>���)�timeout�)rQg{�G�z�?�rTrQg�?��
returncode�cs<tj|d|d�\}}��t|�d���t|�d�||fS)N���Q��?rVrU��r0�
wait_procsr7�len��procsrQ�gone�alive�r<r$r*�test{s�
z-TestProcessAPIs.test_wait_procs.<locals>.testcSsg|]
}|j�qSr$r%r'r$r$r*r+�scs<tj|d|d�\}}��t|�d���t|�d�||fS)NrZrVrWrr\r_rcr$r*rd�s�
)r2r:rDr0r]�	TypeError�time�
assertLessr7r^�assertFalse�hasattrr�	terminater-r&r	�poprX�signal�SIGTERM�set�
assertTrue)r<rQ�sproc1�sproc2�sproc3r`�trarbr=rdr$)rPr<r*�test_wait_procsdsF zTestProcessAPIs.test_wait_procscCsP|��}|��}|��}dd�|||fD�}|D]}|��q0t�|�\}}dS)NcSsg|]}t�|j��qSr$rRr'r$r$r*r+�sz>TestProcessAPIs.test_wait_procs_no_timeout.<locals>.<listcomp>)r2rjr0r])r<rprqrrr`r=rarbr$r$r*�test_wait_procs_no_timeout�s
z*TestProcessAPIs.test_wait_procs_no_timeoutcCsv|��}|�t�|j��t�|j�}|��|��|�t�|j��|�t�d��|�	t�d�dt�
�k�dS)NrSr)r2ror0�
pid_existsr&r3r4r5rhr7rPr;r$r$r*�test_pid_exists�szTestProcessAPIs.test_pid_existsc	Cs�t��}|D]L}zt�|�s t�Wqtk
rVt�d�|t��krR|�|�YqXqtt|�dt|�d�}|D]}|j	t�|�|d�qxdS)Ng�������?i�ip��msg)
r0rPrvrHrf�sleep�fail�range�maxrh)r<rPr&r$r$r*�test_pid_exists_2�s
z!TestProcessAPIs.test_pid_exists_2N)
�__name__�
__module__�__qualname__r>rMr"�skipIfrrrtrurwr~r$r$r$r*r#=s
�
7
�
	
r#c@sBeZdZdd�Ze�eo e��d�dd��Z	dd�Z
dd	�Zd
S)�TestMiscAPIscCs4t��}|�|t�|�|d�|�|t���dS�Nr)r0Z	boot_time�assertIsInstance�float�
assertGreaterrgrf)r<Zbtr$r$r*�test_boot_time�szTestMiscAPIs.test_boot_time�unreliable on CIcCs�t��}|�|g�|D]�}|js*t|��|�|jt�|�|jttd�f�|j	dk	rn|�|j	ttd�f�|j|j	|j
dks�t|��tj�|j
�t
s�tr�|�|j�qt�|j�qdS)N�)r0�users�assertNotEqual�namerHr��strZterminal�typeZhostZstarted�datetimeZ
fromtimestamprrrEr&r3)r<r��userr$r$r*�
test_users�s
zTestMiscAPIs.test_userscCs&tj}tt_zt��W5|t_XdSrN)�sys�stdoutrr0rd)r<r�r$r$r*�	test_test�s
zTestMiscAPIs.test_testc	Cs�ddddddddd	g	}|D]}|jtt|�t|d
�qtjdk�rDtjsLt�tjrVt�|�	d�dt
j��kr�tj
sxt�|�	d�n�d
t
j��kr�tjs�t�|�tjtjtjg�d�d�|�	d�|�	d�|�	d�|�	d�n^dt
j��k�sdt
j��k�rtj�st�|�	d	�n&dt
j��k�rftj�s8t�|�	d�n"tj�sPt�tj�r\t�|�	d�|D]}|jtt|�d|d
��qjdS)Nr	rrrrrrrr
rx�posixZlinuxZbsdTrUZsunosZsolaris�darwinF)r��getattrr0�boolr.r�r	rHr�remover��platform�lowerrrr7rrr�countr
rrJ)r<�namesr�r$r$r*�test_os_constants�sP�




���


�
zTestMiscAPIs.test_os_constantsN)rr�r�r�r"r�rr0r�r�r�r�r$r$r$r*r��s

	r�c@seZdZdd�Zdd�ZdS)�TestMemoryAPIscCs�t��}|jdkst|��|jdks,t|��d|jkrBdksLnt|��|jdks^t|��|jdkspt|��|jD]j}t	||�}|dkr�|�
|ttf�|dkrv|dks�|�
d||f�||jkrv|�
d||j||f�qvdS)Nr�d�percent�totalz%r < 0 (%s)z%r > total (total=%s, %s=%s))r0Zvirtual_memoryr�rHZ	availabler��used�free�_fieldsr�r��intr
r{)r<�memr��valuer$r$r*�test_virtual_memorys" 


�z"TestMemoryAPIs.test_virtual_memorycCs�t��}|�|jd�|jdks(t|��|jdks:t|��|jdkrX|jdksjt|��n|jdksjt|��d|jkr�dks�nt|��|j	dks�t|��|j
dks�t|��dS)N)r�r�r�r��sin�soutrr�)r0Zswap_memoryr7r�r�rHr�r�r�r�r�)r<r�r$r$r*�test_swap_memory s�
 zTestMemoryAPIs.test_swap_memoryN)rr�r�r�r�r$r$r$r*r�sr�c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Ze�ed�d d!��Ze�ed"�d#d$��Zd%S)&�TestCpuAPIsc	Cstt��}|�|�|�|ttjdd���|�|d�tj�	d�rpt
d��}|��}W5QRXd|krpt�
d��dS)NT��percpurUz
/proc/cpuinfozphysical idz#cpuinfo doesn't include physical id)r0�	cpu_countZassertIsNotNoner7r^rArFr.�path�exists�open�readr"ZSkipTest)r<�logical�fdZcpuinfo_datar$r$r*�test_cpu_count_logical3s

z"TestCpuAPIs.test_cpu_count_logicalcCsft��}tjdd�}|dkr&|�d��trJt��dd�dkrJ|�|�n|�|d�|�||�dS)NF�r�zphysical cpu_count() is Noner[)�rUrU)r0r��skipTestrr�ZgetwindowsversionrErF)r<r�Zphysicalr$r$r*�test_cpu_count_physical?s
z#TestCpuAPIs.test_cpu_count_physicalc
CsvdD]l}tjd|d��}|�t���|js0t�W5QRXtjd|d��"}|�tjdd��|jsft�W5QRXqdS)N)rSrNz$psutil._psplatform.cpu_count_logical�Zreturn_valuez%psutil._psplatform.cpu_count_physicalFr�)rr6rEr0r�rGrH)r<�valrKr$r$r*�test_cpu_count_noneJs��zTestCpuAPIs.test_cpu_count_nonecCsZd}t��}t|�|D]$}|�|t�|�|d�||7}q|�|t|��t|�dS)Nrr�)r0rA�sumr�r�rFr7r�)r<r��times�cp_timer$r$r*�test_cpu_timesVs
zTestCpuAPIs.test_cpu_timescCsLtt���}t��t}t��|kr>tt���}||krdSq|�d�dS)Nztime remained the same)r�r0rArfrr{)r<�t1Zstop_at�t2r$r$r*�test_cpu_times_time_increasesssz)TestCpuAPIs.test_cpu_times_time_increasescCs�tjdd�D]R}d}t|�|D]$}|�|t�|�|d�||7}q |�|t|��t|�q|�ttjdd�d�ttjdd���dS)NTr�rr�F)	r0rAr�r�r�rFr7r�r^)r<r�r�r�r$r$r*�test_per_cpu_times}s

�zTestCpuAPIs.test_per_cpu_timescCs�tjdd�}t��t}t��|kr.|�d�Stjdd�}t||�D]4\}}t�|�t�|�}}||}|dkrDdSqDqdS)NTr�rTg�������?)r0rArfrr{�zipZ_cpu_busy_time)r<Ztot1Z	giveup_atZtot2r�r��
differencer$r$r*�test_per_cpu_times_2�s
z TestCpuAPIs.test_per_cpu_times_2cCsXt��}tjdd�}|�dd�t|�D��}|jD] }|jt||�t||�dd�q2dS)NTr�cSsg|]}t|��qSr$)r�)r(Znumr$r$r*r+�sz9TestCpuAPIs.test_cpu_times_comparison.<locals>.<listcomp>rU�Zdelta)r0rA�_maker�r��assertAlmostEqualr�)r<�baseZper_cpuZ
summed_valuesZfieldr$r$r*�test_cpu_times_comparison�s
�z%TestCpuAPIs.test_cpu_times_comparisonc
Cs�z<|�|t�|�|d�|�|d�|�|dt���Wn@tk
r|}z"td|t�	|�t�	|�f��W5d}~XYnXdS)Nr�g�gY@z
%s
last=%s
new=%s)
r�r�rFZassertIsNot�assertLessEqualr0r�rH�pprintZpformat)r<r�Zlast_retZnew_ret�errr$r$r*�_test_cpu_percent�s�zTestCpuAPIs._test_cpu_percentc	Cs^tjdd�}td�D]"}tjdd�}|�|||�|}q|�t��tjdd�W5QRXdS�N���MbP?)�intervalr�rS)r0�cpu_percentr|r�r:rD)r<�lastr)�newr$r$r*�test_cpu_percent�szTestCpuAPIs.test_cpu_percentc	Cs�tjddd�}|�t|�t���td�D].}tjddd�}|D]}|�|||�q@|}q*|�t��tjddd�W5QRXdS)Nr�T�r�r�r�rS)	r0r�r7r^r�r|r�r:rD�r<r�r)r�r�r$r$r*�test_per_cpu_percent�sz TestCpuAPIs.test_per_cpu_percentc	Csztjdd�}td�D]>}tjdd�}|D]}|�|||�q(|�t|�||�|}q|�t��tjdd�W5QRXdSr�)r0�cpu_times_percentr|r�r�r:rDr�r$r$r*�test_cpu_times_percent�sz"TestCpuAPIs.test_cpu_times_percentcCsztjddd�}|�t|�t���td�D]J}tjddd�}|D].}|D]}|�|||�qH|�t|�||�q@|}q*dS)Nr�Tr�r�)r0r�r7r^r�r|r�r�)r<r�r)r��cpur�r$r$r*�test_per_cpu_times_percent�sz&TestCpuAPIs.test_per_cpu_times_percentc	Csjtjdd�dd�tjdd�D�}tjd|d��0tjdd�D]}|D]}|�|dd�qFq>W5QRXdS)NTr�cSs*g|]"}|�dd�tt|j��D���qS)cSsg|]}d�qS)rr$r'r$r$r*r+�szNTestCpuAPIs.test_per_cpu_times_percent_negative.<locals>.<listcomp>.<listcomp>)r�r|r^r�r'r$r$r*r+�s�zCTestCpuAPIs.test_per_cpu_times_percent_negative.<locals>.<listcomp>zpsutil.cpu_timesr�)r0r�rArr6r�)r<Z
zero_timesr�r�r$r$r*�#test_per_cpu_times_percent_negative�s
�z/TestCpuAPIs.test_per_cpu_times_percent_negativecCsTt��}|�|jd�|jD]2}t||�}|�|d�ts|dkr|�|d�qdS)N)�ctx_switches�
interruptsZsoft_interruptsZsyscallsr)r�r�)r0Z	cpu_statsr7r�r�rFrr�)r<Zinfosr�r�r$r$r*�test_cpu_stats�s�

zTestCpuAPIs.test_cpu_statsznot suportedcsd�fdd�}tjdd�}tr*|s*��d��|s6t|��|tjdd�g�tr`��t|�t���dS)Ncsj|D]`}��|jd�|jdkr0��|j|j�|jD],}t||�}��|ttt	f���
|d�q6qdS)N)�current�minr}r�r)r7r�r}r�r�r�r�r�r
r�rF)�ls�ntr�r�rcr$r*�check_lss


z+TestCpuAPIs.test_cpu_freq.<locals>.check_lsTr�zreturns empty list on FreeBSDF)	r0Zcpu_freqrr�rHrr7r^r�)r<r�r�r$rcr*�
test_cpu_freqs

zTestCpuAPIs.test_cpu_freq�
not supportedcCs>t��}|�t|�d�|D]}|�|t�|�|d�qdS)NrWr�)r0�
getloadavgr7r^r�r�rF)r<Zloadavg�loadr$r$r*�test_getloadavgs
zTestCpuAPIs.test_getloadavgN)rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r"r�rr�rr�r$r$r$r*r�1s&
!

	


r�c@s�eZdZe�eoed�dd��Ze�ed�dd��Z	dd�Z
d	d
�Ze�eo\e
j�d�d�e�eope��d
�dd���Zdd�ZdS)�TestDiskAPIszunreliable on PYPY32 + 32BITc	Cst�t���}|�|jd�|jdks.t|��|jdks@t|��|j	dksRt|��|j|jksft|��|j|j	kszt|��d|j
kr�dks�nt|j
��ttd�r�t�t���}d}|�|j|j�|j
|j	|j	|d�|j
|j|j|d�|��}|�t��t�|�W5QRXdS)N)r�r�r�r�rr��
disk_usageiPr�)r0r�r.�getcwdr7r�r�rHr�r�r�ri�shutilr�Z
get_testfnr:r)r<ZusageZshutil_usageZ	toleranceZfnamer$r$r*�test_disk_usage#s*"
��zTestDiskAPIs.test_disk_usageznot an ASCII fsc	Cs$|�t��t�t�W5QRXdSrN)r:�UnicodeEncodeErrorr0r�r!rcr$r$r*�test_disk_usage_unicode>sz$TestDiskAPIs.test_disk_usage_unicodecCst�d�dS)N�.)r0r�rcr$r$r*�test_disk_usage_bytesDsz"TestDiskAPIs.test_disk_usage_bytescs��fdd�}tjdd�}�j||d�|D]b}||�trFd|jkrFq*tsbtj�|j	�sht
|��n|j	tj�|j�s~t
|��|js*t
|��q*tjdd�}�j||d�tjdd�D]�}||�ts�|jr�zt�
|j�Wn\tk
�r6}z<t�rt�r|jtjk�rWY�q�|jtjtjfk�r&�W5d}~XYq�Xtj�|j�s�t
|��q�dd	�}|t�}d
d�tjdd�D�}��||�dS)Ncs���|jt���|jt���|jt���|jt���|jttd�f���|j	ttd�f�|jdk	r�t
s���|jd�|j	dk	r���|j	d�dSr�)r��devicer��
mountpoint�fstype�optsZmaxfiler�r�Zmaxpathr r��r�rcr$r*�check_ntupleHs
z7TestDiskAPIs.test_disk_partitions.<locals>.check_ntupleF)�allrxZcdromTcSs.tj�|�}tj�|�s&tj�|�}q|��SrN)r.r��abspath�ismount�dirnamer�)r�r$r$r*�find_mount_pointysz;TestDiskAPIs.test_disk_partitions.<locals>.find_mount_pointcSsg|]}|jr|j���qSr$)r�r�r'r$r$r*r+�s�z5TestDiskAPIs.test_disk_partitions.<locals>.<listcomp>)r0Zdisk_partitionsrorr�r	r.r�r�r�rHr�r��stat�OSErrorr r�errnoZEIOZEPERMZEACCES�__file__r-)r<r�r�Zdiskr�rZmountZmountsr$rcr*�test_disk_partitionsGs>


�z!TestDiskAPIs.test_disk_partitionsz/proc/diskstatsz3/proc/diskstats not available on this linux versionr�csz�fdd�}tjdd�}|dk	s(td��||�tjdd�}��t|�tt|���|D]}|sht|��|||�qXdS)Ncs���|d|j���|d|j���|d|j���|d|j�ts�tsƈ�|d|j���|d|j�t	r���|d|j
���|d|j���|d	|j�nt
rƈ�|d|j�|jD]}t||�dks�t|��q�dS)
NrrUr[rW��r���)r7Z
read_countZwrite_countZ
read_bytesZwrite_bytesrrZ	read_timeZ
write_timerZread_merged_countZwrite_merged_countZ	busy_timerr�r�rH)r�r�rcr$r*r��s
z8TestDiskAPIs.test_disk_io_counters.<locals>.check_ntupleF�Zperdiskzno disks on this system?T)r0�disk_io_countersrHr7r^rn�r<r��ret�keyr$rcr*�test_disk_io_counters�sz"TestDiskAPIs.test_disk_io_countersc	CsNtjdid��6}|�tjdd��|�tjdd�i�|js@t�W5QRXdS)Nz#psutil._psplatform.disk_io_countersr�Fr
T)rr6rEr0rr7rGrH�r<rKr$r$r*�test_disk_io_counters_no_disks�s�z+TestDiskAPIs.test_disk_io_counters_no_disksN)rr�r�r"r�rrr�rr�r�rrr.r�r�rr0rrrr$r$r$r*r�!s

=��r�c@sneZdZe�ed�dd��Ze�ed�dd��Zdd�Zdd	�Z	d
d�Z
e�epZepZe
d�d
d��ZdS)�TestNetAPIsr�csh�fdd�}tjdd�}||�tjdd�}��|g�|D]&}��|���|t�|||�q<dS)Ncs(��|d|j���|d|j���|d|j���|d|j���|d|j���|d|j���|d|j���|d|j�|jdks�t	|��|jdks�t	|��|jdks�t	|��|jdks�t	|��|jdks�t	|��|jdks�t	|��|jdk�st	|��|jdk�s$t	|��dS)	NrrUr[rWr	r
r�r)
r7Z
bytes_sentZ
bytes_recvZpackets_sentZpackets_recvZerrinZerroutZdropinZdropoutrHr�rcr$r*r��s z6TestNetAPIs.test_net_io_counters.<locals>.check_ntupleF�ZpernicT)r0�net_io_countersr�ror�r�rr$rcr*�test_net_io_counters�s
z TestNetAPIs.test_net_io_countersc	CsNtjdid��6}|�tjdd��|�tjdd�i�|js@t�W5QRXdS)Nz"psutil._psplatform.net_io_countersr�FrT)rr6rEr0rr7rGrHrr$r$r*�test_net_io_counters_no_nics�s�z(TestNetAPIs.test_net_io_counters_no_nicscCsht��}|st|��t��}ttjtjtjg�}|�	�D�]�\}}|�
|t�|�t
t|��t
|��|D�]�}|�
|jt�|�
|jt�|�
|jttd�f�|�
|jttd�f�|�|j|�tjdkr�ts�|�
|jtj�||j�r�|jtjk�r2t�|j�}t�|��|�|jdf�W5QRXnj|jtjk�r�t�|jdtjtjdtj �d}|\}	}
}}}
t�|	|
|�}t�|��|�|
�W5QRX|j|j|j|j!fD]*}|dk	�r�|jtjk�r�t"||j��q�|j�r�|�#|j!�qj|j!rj|�#|j�qjq8t$�st%�st&�r8t'td��rd|�tjtj�n,t(�rP|�tjtj)�nt*�rd|�tjd�dS)N)rWr	r�AF_LINKrS)+r0�net_if_addrsrH�net_if_statsrn�socketZAF_INETZAF_INET6r�itemsr�r�r7r^Zfamilyr��addressZnetmaskr�Z	broadcastr-r��version_inforr�IntEnum�isup�
contextlib�closingZbindZgetaddrinfoZSOCK_STREAMZ
AI_PASSIVEZptprrErrr
rirZ	AF_PACKETr)r<�nicsZ	nic_statsZfamiliesZnicZaddrs�addr�srBZafZsocktype�protoZ	canonnameZsaZipr$r$r*�test_net_if_addrs�sh
���
zTestNetAPIs.test_net_if_addrsc	Csztrdtjddddfg}ndg}tjd|d��B}t��dd}|jsJt�tr^|�|j	d�n|�|j	d�W5QRXdS)	N�em1z06:3d:29)r*rSz06-3d-29NNNzpsutil._psplatform.net_if_addrsr�rz06:3d:29:00:00:00z06-3d-29-00-00-00)
r	r0rrr6rrGrHr7r)r<rrKr&r$r$r*� test_net_if_addrs_mac_null_bytess�
z,TestNetAPIs.test_net_if_addrs_mac_null_bytesc	Cs�t��}|st|��tjtjtjf}|��D]\\}}|�|t�|\}}}}|�|t	�|�
||�|�
||�|�|d�|�|d�q,dSr�)r0rrHZNIC_DUPLEX_FULLZNIC_DUPLEX_HALFZNIC_DUPLEX_UNKNOWNrr�r�r�r-rF)	r<r%Zall_duplexesr�Zstatsr"ZduplexZspeedZmtur$r$r*�test_net_if_stats$s�zTestNetAPIs.test_net_if_statszLINUX or BSD or MACOS specificc	CsDtjdttjd�d��$}t��}|�|i�|js6t	�W5QRXdS)Nzpsutil._psutil_posix.net_if_mtur@r,)
rr6rrZENODEVr0rr7rGrH)r<rKrr$r$r*�test_net_if_stats_enodev3s
�z$TestNetAPIs.test_net_if_stats_enodevN)rr�r�r"r�rrrr)r+r,rrrr-r$r$r$r*r�s

	<�rc@sreZdZe�ed�dd��Ze�ed�dd��Ze�ed�e�e	d�dd���Z
e�ed�d	d
��ZdS)�TestSensorsAPIsr�cCs�t��}|��D]t\}}|�|t�|D]Z}|�|jt�|jdk	rR|�|jd�|jdk	rj|�|jd�|j	dk	r(|�|j	d�q(qdSr�)
r0�sensors_temperaturesrr�r��labelr�rF�high�critical)r<�tempsr��entries�entryr$r$r*�test_sensors_temperatures@s


z)TestSensorsAPIs.test_sensors_temperaturesc	Cspddgi}tjd|d��N}tjdd�dd}|js8t�|�|jd�|�|jd	�|�|j	d
�W5QRXdS)NZcoretemp)r0gI@gN@g�Q@z'psutil._psplatform.sensors_temperaturesr�T)Z
fahrenheitrg�^@g�a@g�c@)
rr6r0r/rGrHr7r�r1r2)r<�drKr3r$r$r*�#test_sensors_temperatures_fahreneitNs 
����
z3TestSensorsAPIs.test_sensors_temperatures_fahreneitz
no batterycCspt��}|�|jd�|�|jd�|jtjtjfkrF|�|jd�n|jtjkr^|�|j	�|�
|j	t�dS)Nrr�)r0Zsensors_batteryrFr�r�ZsecsleftZPOWER_TIME_UNKNOWNZPOWER_TIME_UNLIMITEDroZ
power_pluggedr�r�)r<rr$r$r*�test_sensors_batteryZs�z$TestSensorsAPIs.test_sensors_batterycCsbt��}|��D]L\}}|�|t�|D]2}|�|jt�|�|jttf�|�	|jd�q(qdSr�)
r0Zsensors_fansrr�r�r0r�r�r
rF)r<Zfansr�r4r5r$r$r*�test_sensors_fanshsz!TestSensorsAPIs.test_sensors_fansN)
rr�r�r"r�rr6r8rrr9rr:r$r$r$r*r.>s


r.�__main__)�
run_from_name):�__doc__r#r�rr.r�r�rlrr�rfr0rrrrrrrr	r
rZpsutil._compatrr
Zpsutil.testsrrrrrrrrrrrrrrrrrrr r!r"r#r�r�r�r�rr.rZpsutil.tests.runnerr<rr$r$r$r*�<module>stJ%q5


Filemanager

Name Type Size Permission Actions
__init__.cpython-38.opt-1.pyc File 44.89 KB 0644
__init__.cpython-38.pyc File 46.44 KB 0644
__main__.cpython-38.opt-1.pyc File 285 B 0644
__main__.cpython-38.pyc File 285 B 0644
runner.cpython-38.opt-1.pyc File 10.84 KB 0644
runner.cpython-38.pyc File 10.84 KB 0644
test_aix.cpython-38.opt-1.pyc File 3.3 KB 0644
test_aix.cpython-38.pyc File 3.3 KB 0644
test_bsd.cpython-38.opt-1.pyc File 19.53 KB 0644
test_bsd.cpython-38.pyc File 19.53 KB 0644
test_connections.cpython-38.opt-1.pyc File 15.13 KB 0644
test_connections.cpython-38.pyc File 15.43 KB 0644
test_contracts.cpython-38.opt-1.pyc File 24.81 KB 0644
test_contracts.cpython-38.pyc File 25.64 KB 0644
test_linux.cpython-38.opt-1.pyc File 67.56 KB 0644
test_linux.cpython-38.pyc File 68.67 KB 0644
test_memleaks.cpython-38.opt-1.pyc File 22.59 KB 0644
test_memleaks.cpython-38.pyc File 22.59 KB 0644
test_misc.cpython-38.opt-1.pyc File 22.69 KB 0644
test_misc.cpython-38.pyc File 22.92 KB 0644
test_osx.cpython-38.opt-1.pyc File 7.1 KB 0644
test_osx.cpython-38.pyc File 7.1 KB 0644
test_posix.cpython-38.opt-1.pyc File 12.36 KB 0644
test_posix.cpython-38.pyc File 12.46 KB 0644
test_process.cpython-38.opt-1.pyc File 45.69 KB 0644
test_process.cpython-38.pyc File 46.52 KB 0644
test_sunos.cpython-38.opt-1.pyc File 1.5 KB 0644
test_sunos.cpython-38.pyc File 1.5 KB 0644
test_system.cpython-38.opt-1.pyc File 25.65 KB 0644
test_system.cpython-38.pyc File 26.92 KB 0644
test_testutils.cpython-38.opt-1.pyc File 15.6 KB 0644
test_testutils.cpython-38.pyc File 16.27 KB 0644
test_unicode.cpython-38.opt-1.pyc File 10.87 KB 0644
test_unicode.cpython-38.pyc File 10.87 KB 0644
test_windows.cpython-38.opt-1.pyc File 27.81 KB 0644
test_windows.cpython-38.pyc File 28 KB 0644