[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.22.217.176: ~ $
U

�=�_~�@s
dZddlZddlZddlZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
ddlmZd
d�Zdd�Zdd�Ze�ed�Gdd�de��Ze�ed�Gdd�de��Zedk�rddlmZee�dS)zmacOS specific tests.�N)�MACOS)�HAS_BATTERY)�PsutilTestCase)�retry_on_failure)�sh)�spawn_testproc)�	terminate)�TOLERANCE_DISK_USAGE)�TOLERANCE_SYS_MEM)�unittestcCs<t|�}|��d}z
t|�WStk
r6|YSXdS)zmExpects a sysctl command with an argument and parse the result
    returning only the value of interest.
    �N)r�split�int�
ValueError)Zcmdline�out�result�r�H/opt/alt/python38/lib64/python3.8/site-packages/psutil/tests/test_osx.py�sysctls
rcCsTddlm}td�}|�d�D]}||krq8qtd��tt�d|��d��|�S)z)Wrapper around 'vm_stat' cmdline utility.r)�getpagesize�vm_stat�
zline not foundz\d+)	Zpsutil._psutil_posixrrr
rr�re�search�group)Zfieldrr�linerrrr%src	Cs�ddi}|}d}|r$|dd���s4|dd�dkrN||d7}|dd�}qt|�}|��}|��D]\}}||krfq�qf|dkr�|d}|��}ntd|��|ddi}t|dd��D]\}}d|dd	>||<q�t|||�S)
NZ	customary)	�B�K�M�G�T�P�E�Z�Y�rr�.�kzcan't interpret %r�
)�isdigit�float�strip�items�upperr�	enumerater)	�sZSYMBOLSZinit�numZletter�nameZsset�prefix�irrr�human2bytes3s*�$
r4z
MACOS onlyc@s,eZdZedd��Zedd��Zdd�ZdS)�TestProcesscCst�j|_dS�N)r�pid��clsrrr�
setUpClassPszTestProcess.setUpClasscCst|j�dSr6)rr7r8rrr�
tearDownClassTszTestProcess.tearDownClassc	Cs�td|j�}|�dd���}|�d�d}|�d�d}t�|j���}|�|t	�
dt	�|���|�|t	�
dt	�|���dS)	Nzps -o lstart -p %sZSTARTEDr%� ������z%H:%M:%Sz%Y)rr7�replacer+r
�psutilZProcessZcreate_time�assertEqual�time�strftime�	localtime)�self�outputZstart_psZhhmmssZyearZstart_psutilrrr�test_process_create_timeXs��z$TestProcess.test_process_create_timeN)�__name__�
__module__�__qualname__�classmethodr:r;rGrrrrr5Ms


r5c@s�eZdZe�dd��Zdd�Zdd�Zdd�Zd	d
�Ze�dd��Z	e�d
d��Z
e�dd��Ze�dd��Ze�dd��Z
e�dd��Zdd�Ze�ed�dd��ZdS)�TestSystemAPIscCs|dd�}tjdd�D]b}t�|j�}||j�\}}}}|�|j|�|�|j|�|j|j|t	d�|j|j
|t	d�qdS)NcSs�td|���}|�d�}|�d�|�d�}|��dd�\}}}}|dkrRd}t|�d}t|�d}t|�d}||||fS)Nz
df -k "%s"rr�Znoner%i)rr+r
�popr)�pathr�linesr�dev�total�used�freerrr�dfos


z%TestSystemAPIs.test_disks.<locals>.dfF)�all�Zdelta)r@Zdisk_partitionsZ
disk_usageZ
mountpointrAZdevicerR�assertAlmostEqualrTr	rS)rErU�partZusagerQrRrSrTrrr�
test_disksks

�
�zTestSystemAPIs.test_diskscCs td�}|�|tjdd��dS)Nzsysctl hw.logicalcpuT�Zlogical�rrAr@�	cpu_count�rEr0rrr�test_cpu_count_logical�sz%TestSystemAPIs.test_cpu_count_logicalcCs td�}|�|tjdd��dS)Nzsysctl hw.physicalcpuFr[r\r^rrr�test_cpu_count_physical�sz&TestSystemAPIs.test_cpu_count_physicalcCsZt��}|�|jddtd��|�|jddtd��|�|jddtd��dS)Ni�zsysctl hw.cpufrequencyzsysctl hw.cpufrequency_minzsysctl hw.cpufrequency_max)r@Zcpu_freqrAZcurrentr�min�max)rEZfreqrrr�
test_cpu_freq�s���zTestSystemAPIs.test_cpu_freqcCstd�}|�|t��j�dS)Nzsysctl hw.memsize)rrAr@�virtual_memoryrR)rEZsysctl_hwphymemrrr�test_vmem_total�szTestSystemAPIs.test_vmem_totalcCs&td�}t��j}|j||td�dS)NrTrW)rr@rdrTrXr
�rEZ
vmstat_valZ
psutil_valrrr�test_vmem_free�s
zTestSystemAPIs.test_vmem_freecCs&td�}t��j}|j||td�dS)N�activerW)rr@rdrhrXr
rfrrr�test_vmem_active�s
zTestSystemAPIs.test_vmem_activecCs&td�}t��j}|j||td�dS)N�inactiverW)rr@rdrjrXr
rfrrr�test_vmem_inactive�s
z!TestSystemAPIs.test_vmem_inactivecCs&td�}t��j}|j||td�dS)N�wiredrW)rr@rdrlrXr
rfrrr�test_vmem_wired�s
zTestSystemAPIs.test_vmem_wiredcCs"td�}t��j}|�||�dS)NZPageins)rr@�swap_memoryZsinrArfrrr�test_swapmem_sin�s
zTestSystemAPIs.test_swapmem_sincCs"td�}t��j}|�||�dS)NZPageout)rr@rnZsoutrArfrrr�test_swapmem_sout�s
z TestSystemAPIs.test_swapmem_soutc	Cstt����D]b\}}ztd|�}Wntk
r8YqX|j|jd|k|d�|�|jtt	�
d|�d��qdS)Nzifconfig %sZRUNNING)�msgz	mtu (\d+)r)r@Znet_if_statsr,r�RuntimeErrorrAZisupZmturr�findall)rEr1Zstatsrrrr�test_net_if_stats�s�z TestSystemAPIs.test_net_if_statsz
no batterycCs`td�}t�d|��d�}t�d|��d�}|dk}t��}|�|j|�|�|jt	|��dS)Nz
pmset -g battz(\d+)%rzNow drawing from '([^']+)'zAC Power)
rrrrr@Zsensors_batteryrA�
power_plugged�percentr)rErrvZdrawing_fromruZ
psutil_resultrrr�test_sensors_battery�sz#TestSystemAPIs.test_sensors_batteryN)rHrIrJrrZr_r`rcrergrirkrmrorprtr�skipIfrrwrrrrrLfs*







rL�__main__)�
run_from_name)�__doc__rrBr@rZpsutil.testsrrrrrrr	r
rrrr4rxr5rLrHZpsutil.tests.runnerrz�__file__rrrr�<module>s0


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