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_windows.cpython-310.pyc
o

���a�}�@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlm
Z
ddlmZddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZe
r�es�e� ��e�!d�ddl"Z"ddl#Z#ddl$Z$ddl%Z%Wd�n1s�wYe
r�ddl&m'Z'ej(j)Z)e�*e
d�e�*ed�e�*eo�ed�Gdd�de����Z+Gdd�de+�Z,Gdd�de+�Z-Gdd �d e+�Z.Gd!d"�d"e+�Z/Gd#d$�d$e+�Z0e�*e
d�Gd%d&�d&e��Z1e�*e
d�Gd'd(�d(e��Z2e�*e
d�Gd)d*�d*e��Z3e4d+k�rUdd,l5m6Z6e6e7�dSdS)-zWindows specific tests.�N)�WINDOWS)�FileNotFoundError)�super)�APPVEYOR)�GITHUB_ACTIONS)�HAS_BATTERY)�IS_64BIT)�PY3)�PYPY)�TOLERANCE_DISK_USAGE)�PsutilTestCase)�mock)�retry_on_failure)�sh)�spawn_testproc)�	terminate)�unittest�ignore)�convert_oserrorzWINDOWS onlyzpywin32 not available on PYPYzpywin32 broken on GITHUB + PY2c@seZdZdS)�WindowsTestCaseN)�__name__�
__module__�__qualname__�rr�;/usr/lib/python3/dist-packages/psutil/tests/test_windows.pyr9src@sNeZdZe�dejvd�dd��Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�ZdS)�TestCpuAPIs�NUMBER_OF_PROCESSORSz-NUMBER_OF_PROCESSORS env var is not availablecCs"ttjd�}|�|t���dS)Nr)�int�os�environ�assertEqual�psutil�	cpu_count)�self�num_cpusrrr�&test_cpu_count_vs_NUMBER_OF_PROCESSORSHsz2TestCpuAPIs.test_cpu_count_vs_NUMBER_OF_PROCESSORScCs$t��d}t��}|�||�dS)N�)�win32api�
GetSystemInfor!r"r �r#�	sys_value�psutil_valuerrr�test_cpu_count_vs_GetSystemInfoPsz+TestCpuAPIs.test_cpu_count_vs_GetSystemInfocCs*t��}|��d}|�t��|j�dS�Nr)�wmi�WMI�Win32_Processorr r!r"�NumberOfLogicalProcessors�r#�w�procrrr�test_cpu_count_logical_vs_wmiWsz)TestCpuAPIs.test_cpu_count_logical_vs_wmicCs.t��}|��d}|�tjdd�|j�dS)NrF)�logical)r.r/r0r r!r"�
NumberOfCoresr2rrr�test_cpu_count_cores_vs_wmi\sz'TestCpuAPIs.test_cpu_count_cores_vs_wmicCs |�t��ttjdd���dS)NT)�percpu)r r!r"�len�	cpu_times�r#rrr�test_cpu_count_vs_cpu_timesas
�z'TestCpuAPIs.test_cpu_count_vs_cpu_timescCs@t��}|��d}|�|jt��j�|�|jt��j	�dSr-)
r.r/r0r �CurrentClockSpeedr!�cpu_freq�current�
MaxClockSpeed�maxr2rrr�
test_cpu_freqeszTestCpuAPIs.test_cpu_freqN)
rrrr�skipIfrrr%r,r5r8r=rCrrrrrFs�
rc@sreZdZdd�Zdd�Ze�ed�e�dd���Z	e�dd	��Z
e�d
d��Zdd
�Zdd�Z
dd�Zdd�ZdS)�TestSystemAPIscCsRtd�}tjdd���}|D]}d|�dd���vrq||vr&|�d|�qdS)Nz
ipconfig /allT)�perniczpseudo-interface� �-z-%r nic wasn't found in 'ipconfig /all' output)rr!�net_io_counters�keys�replace�lower�fail)r#�out�nics�nicrrr�test_nic_namesns���zTestSystemAPIs.test_nic_namescCs,t����d}|�t|j�t��j�dSr-)	r.r/�Win32_ComputerSystemr r�TotalPhysicalMemoryr!�virtual_memory�total)r#r3rrr�test_total_phymemxs�z TestSystemAPIs.test_total_phymemztest not relieable on appveyorcCs:t����}tdd�|D��}tt���}|�||�dS)NcSsg|]}|j�qSr��	ProcessId��.0�xrrr�
<listcomp>�sz,TestSystemAPIs.test_pids.<locals>.<listcomp>)r.r/�
Win32_Process�setr!�pidsr )r#r3�wmi_pids�psutil_pidsrrr�	test_pids�szTestSystemAPIs.test_pidsc
Cs�tjdd�}t����}|D]l}|D]^}|j�dd�|jkrp|js#nWd|j	vr*nP|j�
d�r2nHzt�|j�}Wn
tyDYn6w|�
|jt|j��t|j�}|�
|j|�t|j|�dkrn|�d|j|f�n
q|�d	t|��qdS)
NT��all�\��cdrom�A:i�zpsutil=%s, wmi=%szcan't find partition %s)r!�disk_partitionsr.r/�Win32_LogicalDisk�devicerK�DeviceID�
mountpoint�opts�
startswith�
disk_usagerr rUr�Size�	FreeSpace�free�absrM�repr)r#�ps_parts�	wmi_parts�ps_part�wmi_part�usage�wmi_freerrr�
test_disks�s8
�
����zTestSystemAPIs.test_diskscCsxt��D]5}d|jvrqt�|j�}t�|j�}|j|d|jt	d�|j|d|j
t	d�|�|j|j
|j�qdS)Nrgr��delta�)
r!rirnr'�GetDiskFreeSpaceExrmrp�assertAlmostEqualrsrrUr �used)r#�diskr*r+rrr�test_disk_usage�s
��
��zTestSystemAPIs.test_disk_usagecCs>dd�t���d�D�}dd�tjdd�D�}|�||�dS)NcSs"g|]
}|r|�d�s|d�qS)rhre)rorYrrrr\�s���z7TestSystemAPIs.test_disk_partitions.<locals>.<listcomp>z\cSsg|]}|j�d�s|j�qS)rh)rmrorYrrrr\�s
�Trc)r'�GetLogicalDriveStrings�splitr!rir r)rrr�test_disk_partitions�s
�z#TestSystemAPIs.test_disk_partitionscCs\tt���}t����}t�}|D]}|�|j�|�|j�q|�	||@d||f�dS)Nzno common entries in %s, %s)
r^�cext�net_if_statsr.r/�Win32_NetworkAdapter�add�Name�NetConnectionID�
assertTrue)r#�ps_names�wmi_adapters�	wmi_names�wmi_adapterrrr�test_net_if_stats�s

�z TestSystemAPIs.test_net_if_statscCs^t����}|dj�d�d}tj�|d�}tj�t�	��}t
||���}|�|d�dS)Nr�.�%Y%m%d%H%M%S�)
r.r/�Win32_OperatingSystem�LastBootUpTimer��datetime�strptime�
fromtimestampr!�	boot_timert�
total_seconds�assertLessEqual)r#�wmi_os�
wmi_btime_str�wmi_btime_dt�	psutil_dt�diffrrr�test_boot_time�s�zTestSystemAPIs.test_boot_timecCs�tjddd��|�t��d�Wd�n1swYtjddd��|�t��d�Wd�n1s9wYtjddd��|�t��d�Wd�n1sXwYtjddd��|�t��d�Wd�dS1sxwYdS)Nz psutil._pswindows.cext.boot_timer&��return_value��iM)r
�patchr r!r�r<rrr�test_boot_time_fluctuation�s���"�z)TestSystemAPIs.test_boot_time_fluctuationN)rrrrQrVrrDrrrbr|r�r�r�r�r�rrrrrEls





	rEc@s`eZdZdd�Ze�ed�dd��Ze�ed�dd��Zdd	�Z	d
d�Z
dd
�Zdd�ZdS)�TestSensorsBatterycCs0t��dr|�t���dS|�t���dS)N�SystemBatteriesPresent)r'�GetPwrCapabilities�assertIsNotNoner!�sensors_battery�assertIsNoner<rrr�test_has_battery�sz#TestSensorsBattery.test_has_batteryz
no batterycCs6t��}|�d�d}t��}|j|j|jdd�dS)N�select * from Win32_Batteryrrr})r.r/�queryr!r�r��percent�EstimatedChargeRemaining�r#r3�battery_wmi�battery_psutilrrr�test_percent�s
�zTestSensorsBattery.test_percentcCs6t��}|�d�d}t��}|�|j|jdk�dS)Nr�r�)r.r/r�r!r�r �
power_plugged�
BatteryStatusr�rrr�test_power_plugged�s�z%TestSensorsBattery.test_power_pluggedcCsLtjddd��}|�t���|jsJ�Wd�dS1swYdS)N�&psutil._pswindows.cext.sensors_battery)r�rrr�)r
r�r�r!r��called�r#�mrrr�test_emulate_no_batterys�"�z*TestSensorsBattery.test_emulate_no_batterycC�Rtjddd��}|�t��jtj�|jsJ�Wd�dS1s"wYdS)Nr�)rrrrr��r
r�r r!r��secsleft�POWER_TIME_UNLIMITEDr�r�rrr�test_emulate_power_connected���"�z/TestSensorsBattery.test_emulate_power_connectedcCr�)Nr�)r�rrr�r�r�rrr�test_emulate_power_chargingr�z.TestSensorsBattery.test_emulate_power_chargingcCr�)Nr�)rrr���r�)r
r�r r!r�r��POWER_TIME_UNKNOWNr�r�rrr�test_emulate_secs_left_unknownr�z1TestSensorsBattery.test_emulate_secs_left_unknownN)
rrrr�rrDrr�r�r�r�r�r�rrrrr��s

	r�c@s�eZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	e
�ej
d
kd�dd��Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%S)&�TestProcesscC�t�j|_dS�N�r�pid��clsrrr�
setUpClass)�zTestProcess.setUpClasscC�t|j�dSr��rr�r�rrr�
tearDownClass-r�zTestProcess.tearDownClasscCst�d�}|�tj|j�dSr-)r!�Process�assertRaises�AccessDenied�kill�r#�prrr�
test_issue_241s
zTestProcess.test_issue_24cCs�t�d�}|�|��d�t|�|��|�|��dk�z|��dd�\}}Wntj	y>t
��ddvr;�YdSw|�|dk�dS)Nr��Systemgr�r)�vistazwin-7�win7r)r!r�r �name�str�usernamer��create_time�memory_infor��platform�uname)r#r��rss�vmsrrr�test_special_pid5s
��zTestProcess.test_special_pidcCs"t�|j�}|�t|jtj�dSr�)r!r�r�r��
ValueError�send_signal�signal�SIGINTr�rrr�test_send_signalFszTestProcess.test_send_signalcCsbt�t���}|��}t�tjtj	t���}|��}|�
||d�t�|�|�
|��|�dS)Nr)r!r�r�getpid�num_handlesr'�OpenProcess�win32con�PROCESS_QUERY_INFORMATION�FALSEr �CloseHandle)r#r��before�handle�afterrrr�test_num_handles_incrementJs
�
z&TestProcess.test_num_handles_increment)r��zCTRL_* signals not supportedcCsdt�|��j�}|�tj�|�tj�|��|�	�|�
tj|jtj�|�
tj|jtj�dSr�)r!r�rr�r�r��CTRL_C_EVENT�CTRL_BREAK_EVENTr��waitr��
NoSuchProcessr�rrr�test_ctrl_signalsTs��zTestProcess.test_ctrl_signalscCs |�t����t�tj��dSr�)r r!r�r�r'�
GetUserNameExr��NameSamCompatibler<rrr�
test_usernameas
�zTestProcess.test_usernamecCs8t�ddt�����}d�t�����}|�	||�dS)Nz +rG)
�re�subr'�GetCommandLine�strip�joinr!r��cmdliner r)rrr�test_cmdlineeszTestProcess.test_cmdlinecCsJt�tjtjt���}|�tj|�t	�
|�}t���
�}|�||�dSr�)r'r�r�r�r�rr��
addCleanupr��win32process�GetPriorityClassr!r��nicer �r#r�r*r+rrr�	test_niceys
�
zTestProcess.test_nicecCs�t�tjtj|j�}|�tj|�t�	|�}t
�|j���}|�
|d|j�|�
|d|j�|�
|d|j�|�
|d|j�|�
|d|j�|�
|d|j�|�
|d|j�|�
|d|j�|�
|j|j�|�
|j|j�dS)	N�PeakWorkingSetSize�WorkingSetSize�QuotaPeakPagedPoolUsage�QuotaPagedPoolUsage�QuotaPeakNonPagedPoolUsage�QuotaNonPagedPoolUsage�
PagefileUsage�PeakPagefileUsage)r'r�r�r�r�r�rr�r�GetProcessMemoryInfor!r�r�r �	peak_wset�wset�peak_paged_pool�
paged_pool�peak_nonpaged_pool�
nonpaged_pool�pagefile�
peak_pagefiler�r�rrrr�test_memory_info�sB�

�
�
�
��
�
�
�zTestProcess.test_memory_infocCsXt�tjtj|j�}|�tj|�t�	|j�}|�
�|��}t�
|�}|�||�dSr�)r'r�r�r�r�r�rr�r!r�rrr�GetExitCodeProcessr )r#r�r�r+r*rrr�	test_wait�s�
zTestProcess.test_waitcCs\dd�}t�tjtj|j�}|�tj|�|t�	|�d�}t
�|j���}|�
||�dS)Ncs�fdd�td�D�S)Ncsg|]
}d|>�@r|�qS)rr)rZ�i�r[rrr\�szGTestProcess.test_cpu_affinity.<locals>.from_bitmask.<locals>.<listcomp>�@)�ranger*rr*r�from_bitmask�sz3TestProcess.test_cpu_affinity.<locals>.from_bitmaskr)r'r�r�r�r�r�rr�r�GetProcessAffinityMaskr!r��cpu_affinityr )r#r-r�r*r+rrr�test_cpu_affinity�s��zTestProcess.test_cpu_affinitycCs�t�tjtjt���}|�tj|�t	�
|�}t���
�}|�|j|d�|�|j|d�|�|j|d�|�|j|d�|�|j|d�|�|j|d�dS)N�ReadOperationCount�WriteOperationCount�ReadTransferCount�WriteTransferCount�OtherOperationCount�OtherTransferCount)r'r�r�r�r�rr�rr�r�GetProcessIoCountersr!r��io_countersr �
read_count�write_count�
read_bytes�write_bytes�other_count�other_bytesrrrr�test_io_counters�s0
�

�
�
�
�
�
�zTestProcess.test_io_counterscCs�ddl}ddl}d}|jj�|d|j�}|�|jjj|�|j�	�}|jj�
||�|��|j}t
�|j���}|�||�dS)Nr�)�ctypes�ctypes.wintypes�windll�kernel32r�r�rr��wintypes�DWORD�GetProcessHandleCount�byref�valuer!r�r�r )r#rAr�r��hndcntr*r+rrr�test_num_handles�s�

�zTestProcess.test_num_handlesc	Cs�t�}d|_tjd|d��)t�d��}t��}|�tj|j�Wd�n1s*wYWd�n1s9wY|�	|j
d�dS)Ni+z psutil._psplatform.cext.proc_cwd��side_effectz
time.sleepr&)�WindowsError�winerrorr
r�r!r�r�r��cwd�assertGreaterEqual�
call_count)r#�excr�r�rrr�test_error_partial_copy�s���z#TestProcess.test_error_partial_copycCs0t��dd}tj�|�}|�tj|j�dS)Nr�i��)r!r_�_psplatformr�r�r�exe)r#r�r4rrr�test_exe�szTestProcess.test_exeN)rrr�classmethodr�r�r�r�r�r�rrD�sys�version_inforrrrr&r(r0r?rKrTrWrrrrr�'s.


�


r�c@sxeZdZdZedd��Zedd��Zdd�Ze�	e
d�d	d
��Zdd�Zd
d�Z
e�dd��Ze�dd��Zdd�ZdS)�TestProcessWMIz%Compare Process API results with WMI.cCr�r�r�r�rrrr��r�zTestProcessWMI.setUpClasscCr�r�r�r�rrrr��r�zTestProcessWMI.tearDownClasscCs8t��j|jd�d}t�|j�}|�|��|j�dS�NrWr)	r.r/r]r�r!r�r r��Caption�r#r3r�rrr�	test_name�szTestProcessWMI.test_namez!unreliable path on GITHUB_ACTIONScCs@t��j|jd�d}t�|j�}|�|����|j	���dSr\)
r.r/r]r�r!r�r rVrL�ExecutablePathr^rrrrW�szTestProcessWMI.test_execCsFt��j|jd�d}t�|j�}|�d�|���|j	�
dd��dS)NrWrrG�"rf)r.r/r]r�r!r�r rr
�CommandLinerKr^rrrr�s
�zTestProcessWMI.test_cmdlinecCsPt��j|jd�d}t�|j�}|��\}}}d||f}|�|��|�dS)NrWrz%s\%s)	r.r/r]r�r!r��GetOwnerr r�)r#r3r��domain�_r�rrrrs
zTestProcessWMI.test_usernamecCsBt��j|jd�d}t�|j�}|��j}|�|t	|j
��dSr\)r.r/r]r�r!r�r�r�r rr)r#r3r�r�rrr�test_memory_rsss
zTestProcessWMI.test_memory_rsscCsht��j|jd�d}t�|j�}|��j}t|j	�}||kr0||dkr2|�
d||f�dSdSdS)NrWrr@zwmi=%s, psutil=%s)r.r/r]r�r!r�r�r�r�
PageFileUsagerM)r#r3r�r��	wmi_usagerrr�test_memory_vmss

�zTestProcessWMI.test_memory_vmscCs\t��j|jd�d}t�|j�}t|j�d�d�}t	�
dt	�|����}|�
||�dS)NrWrr�r�)r.r/r]r�r!r�r��CreationDater��time�strftime�	localtimer�r )r#r3r��wmic_create�
psutil_createrrr�test_create_time s�zTestProcessWMI.test_create_timeN)rrr�__doc__rXr�r�r_rrDrrWrrrrfrirprrrrr[�s 





r[c@sXeZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�ZdS)�TestDualProcessImplementationa{
    Certain APIs on Windows have 2 internal implementations, one
    based on documented Windows APIs, another one based
    NtQuerySystemInformation() which gets called as fallback in
    case the first fails because of limited permission error.
    Here we test that the two methods return the exact same value,
    see:
    https://github.com/giampaolo/psutil/issues/304
    cCr�r�r�r�rrrr�8r�z(TestDualProcessImplementation.setUpClasscCr�r�r�r�rrrr�<r�z+TestDualProcessImplementation.tearDownClasscCs�t�|j���}tjdttjd�d��E}t�|j���}|�	t
|�t
|��tt
|��D]}|�||d�|�||d�|j
||||dd�q,|jsPJ�Wd�dS1s[wYdS)Nz(psutil._psplatform.cext.proc_memory_info�msgrLrir})r!r�r�r�r
r��OSError�errno�EPERMr r:r,rQr�r�)r#�mem_1�fun�mem_2r)rrrr&@s
�"�z.TestDualProcessImplementation.test_memory_infocC�nt�|j���}tjdttjd�d��}|�	t�|j���|�|j
s%J�Wd�dS1s0wYdS)N�"psutil._psplatform.cext.proc_timesrsrL)r!r�r�r�r
r�rtrurvr r�)r#�ctimerxrrrrpLs
�"�z.TestDualProcessImplementation.test_create_timecCs�t�|j���}tjdttjd�d��*}t�|j���}|j	s!J�|j
|j|jdd�|j
|j|jdd�Wd�dS1s@wYdS)Nr{rsrLg{�G�z�?r})
r!r�r�r;r
r�rtrurvr�r��user�system)r#�cpu_times_1rx�cpu_times_2rrr�test_cpu_timesSs
�

�
�"�z,TestDualProcessImplementation.test_cpu_timescCs�t�|j���}tjdttjd�d��+}t�|j���}t	t
|��D]}|j||||dd�q"|js6J�Wd�dS1sAwYdS)Nz(psutil._psplatform.cext.proc_io_countersrsrLr&r})
r!r�r�r8r
r�rtrurvr,r:r�r�)r#�
io_counters_1rx�
io_counters_2r)rrrr?^s
��"�z.TestDualProcessImplementation.test_io_counterscCrz)Nz(psutil._psplatform.cext.proc_num_handlesrsrL)r!r�r�r�r
r�rtrurvr r�)r#r�rxrrrrKhs
��"�z.TestDualProcessImplementation.test_num_handlescCs�t��D]9}ztj|dd�}tj|dd�}Wn ty6}zt|�}t|tjtjf�s,�WYd}~qd}~ww|�	||�qdS)NT)�use_pebF)
r!r_r��proc_cmdlinertr�
isinstancer�rr )r#r��a�b�errrrrrps�����z*TestDualProcessImplementation.test_cmdlineN)
rrrrqrXr�r�r&rpr�r?rKrrrrrrr,s



rrcspeZdZdZedd��ZddgZ�fdd�Z�fdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Z�ZS)�RemoteProcessTestCasez�Certain functions require calling ReadProcessMemory.
    This trivially works when called on the current process.
    Check that this works on other processes, especially when they
    have a different bitness.
    cCs\d}t�d�D]$}tj|d|gtjtjd�}|��\}}|��|tt�kr+|SqdS)Nz6import sys; sys.stdout.write(str(sys.maxsize > 2**32))zC:\Python*\python.exe�-c)�args�stdout�stderr)	�glob�
subprocess�Popen�PIPE�STDOUT�communicaterr�r)�code�filenamer4�outputrerrr�find_other_interpreter�s���z,RemoteProcessTestCase.find_other_interpreterr�zimport sys; sys.stdin.read()cs�t���|��}|durt�d��trtj|_||_	n||_tj|_	t
j��}t
t
���|d<|j|j	g|j|tjd�|_|j|jg|j|tjd�|_dS)Nz0could not find interpreter with opposite bitness�THINK_OF_A_NUMBER)�env�stdin)r�setUpr�r�SkipTestrrY�
executable�python64�python32rr�copyr�r�r�	test_argsr�r��proc32�proc64)r#�other_pythonr���	__class__rrr��s.
�
��zRemoteProcessTestCase.setUpcs"t���|j��|j��dSr�)r�tearDownr�r�r�r<r�rrr��s

zRemoteProcessTestCase.tearDowncC�@t�|jj�}|�t|���d�|�|��dd�|j�dS�Nr�r)r!r�r�r�r r:r
r�r�rrr�test_cmdline_32��z%RemoteProcessTestCase.test_cmdline_32cCr�r�)r!r�r�r�r r:r
r�r�rrr�test_cmdline_64�r�z%RemoteProcessTestCase.test_cmdline_64cC�&t�|jj�}|�|��t���dSr�)r!r�r�r�r rPr�getcwdr�rrr�test_cwd_32��z!RemoteProcessTestCase.test_cwd_32cCr�r�)r!r�r�r�r rPrr�r�rrr�test_cwd_64�r�z!RemoteProcessTestCase.test_cwd_64cCs>t�|jj�}|��}|�d|�|�|dtt�	���dS)Nr�)
r!r�r�r�r�assertInr r�rr�)r#r��errr�test_environ_32�sz%RemoteProcessTestCase.test_environ_32cCs4t�|jj�}z|��WdStjyYdSwr�)r!r�r�r�rr�r�rrr�test_environ_64�s�z%RemoteProcessTestCase.test_environ_64)rrrrq�staticmethodr�r�r�r�r�r�r�r�r�r��
__classcell__rrr�rr�~s
r�c@seZdZdd�Zdd�ZdS)�TestServicescCsNtgd��}tgd��}tgd��}t��D]�}|��}|�|dt�|�|d��d�|�|dt�|�|dt�|�|d|�|d	durSt�	|d	�|�|d
t�|�|dt�|�|dt�|�|d|�|�|d|�|�|dt�|�
�}|dur�t�	|�}|�|���t�
|���}|�||�qdS)
N)�running�paused�start�pause�continue�stop�stopped)�	automatic�manual�disabled)r�r��
start_pending�
pause_pending�continue_pending�stop_pendingr�r�rf�display_namer��statusr��binpath�
start_type�description)r^r!�win_service_iter�as_dict�assertIsInstancer��assertNotEqualrr�r�r�r��
is_running�win_service_getr�r )r#�valid_statuses�valid_start_types�serv�datar�r��srrr�test_win_service_iter�s2		
�z"TestServices.test_win_service_itercCstjjj}tjjj}tt�����}|�tj	��}t�
|d�Wd�n1s*wY|�|jj|d�t�
|�}t
rGddd|f}n|df}t|�}tjd|d��|�tj	|j�Wd�n1siwYtjd|d��|�tj	|j�Wd�n1s�wYt
r�ddd|f}n|df}t|�}tjd|d��|�tj|j�Wd�n1s�wYtjd|d��|�tj|j�Wd�n1s�wY|�|��t|��|�|��t|��|�|��t|��|�|��t|��dS)Nz???rrsz/psutil._psplatform.cext.winservice_query_statusrLz/psutil._psplatform.cext.winservice_query_config)r!rUr��ERROR_SERVICE_DOES_NOT_EXIST�ERROR_ACCESS_DENIED�nextr�r�r�rr�r �	exceptionr	rNr
r�r�r�r�r�r�r�ru)r#r�r�r��cm�servicer�rSrrr�test_win_service_getsR�
�
��������z!TestServices.test_win_service_getN)rrrr�r�rrrrr��s0r��__main__)�
run_from_name)8rqr�rur�rr�rr�r�rYrk�warningsr!r�psutil._compatrr�psutil.testsrrrrr	r
rrr
rrrrr�catch_warnings�simplefilterr'r�rr.�psutil._pswindowsrrUr�rDrrrEr�r�r[rrr�r�r�psutil.tests.runnerr��__file__rrrr�<module>sz


�
	&<@FQ\
^�

Youez - 2016 - github.com/yon3zu
LinuXploit