__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
�

"j4g����SrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKrSSK
r
SSK
Jr SSKJr SSKJr SSKJr SSKJr SSKJr SS	KJr SS
KJr SSKJr SSKJr SS
KJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJ r  SSKJ!r! \(aC\(d<\RD"5 \RF"S5 SSK$r$SSK%r%SSK&r&SSK'r'SSS5 \(aSSK(J)r) \
RTRVr+\RX"\(+S5\RX"\S5\RX"\=(a \(+S5"SS\5555r-Sr.\/4Sjr0"SS\-5r1"S S!\-5r2"S"S#\-5r3"S$S%\-5r4"S&S'\-5r5\RX"\(+S5"S(S)\55r6\RX"\(+S5"S*S+\55r7\RX"\(+S5"S,S-\55r8\9S.:XaSS/K:J;r; \;"\<5 gg!,(df   GNZ=f)0zWindows specific tests.�N)�WINDOWS)�FileNotFoundError)�super)�which)�APPVEYOR)�GITHUB_ACTIONS)�HAS_BATTERY)�IS_64BIT)�PY3)�PYPY)�TOLERANCE_DISK_USAGE)�TOLERANCE_SYS_MEM)�PsutilTestCase)�mock)�retry_on_failure)�sh)�spawn_testproc)�	terminate�ignore)�convert_oserrorzWINDOWS onlyzpywin32 not available on PYPYzpywin32 broken on GITHUB + PY2c��\rSrSrSrg)�WindowsTestCase�;�N)�__name__�
__module__�__qualname__�__firstlineno__�__static_attributes__r��;/usr/lib/python3/dist-packages/psutil/tests/test_windows.pyrr;s��
	r rc�t�[S5(d[R"S5eSSU--n[U5$)z�Currently not used, but available just in case. Usage:

>>> powershell(
    "Get-CIMInstance Win32_PageFileUsage | Select AllocatedBaseSize")
zpowershell.exezpowershell.exe not availablez?powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive z,-NoProfile -WindowStyle Hidden -Command "%s")r�unittest�SkipTestr)�cmd�cmdlines  r!�
powershellr'CsC���!�"�"���� >�?�?�I�
8�3�
>�	?���g�;�r c�2�[SU<SU<35R5nSRUR5SS5R5nUb=SU;a/[	UR5Vs/sH
oR"U5PM sn5$U"U5$U$s snf)z{Currently not used, but available just in case. Usage:

>>> wmic("Win32_OperatingSystem", "FreePhysicalMemory")
2134124534
z
wmic path z get ��N�,)r�strip�join�
splitlines�tuple�split)�path�what�	converter�out�data�xs      r!�wmicr7Rs���
�d�D�
1�
2�
8�
8�
:�C�
�7�7�3�>�>�#�A�B�'�(�.�.�0�D����$�;���
�
��=��1�)�A�,��=�>�>��T�?�"����	>s�2Bc�~�\rSrSr\R
"S\R;S5S5rSr	Sr
SrSrS	r
S
rg)�TestCpuAPIs�h�NUMBER_OF_PROCESSORSz-NUMBER_OF_PROCESSORS env var is not availablec��[[RS5nURU[R
"55 g)Nr;)�int�os�environ�assertEqual�psutil�	cpu_count)�self�num_cpuss  r!�&test_cpu_count_vs_NUMBER_OF_PROCESSORS�2TestCpuAPIs.test_cpu_count_vs_NUMBER_OF_PROCESSORSis1���r�z�z�"8�9�:������6�#3�#3�#5�6r c��[R"5Sn[R"5nUR	X5 g)N�)�win32api�
GetSystemInforArBr@�rC�	sys_value�psutil_values   r!�test_cpu_count_vs_GetSystemInfo�+TestCpuAPIs.test_cpu_count_vs_GetSystemInfoss3���*�*�,�Q�/�	��'�'�)������1r c��[R"5n[SUR555nUR	[
R"5U5 g)Nc3�8# �UHoRv� M g7f�N)�NumberOfLogicalProcessors��.0�procs  r!�	<genexpr>�<TestCpuAPIs.test_cpu_count_logical_vs_wmi.<locals>.<genexpr>|s���
�7J�t�*�*�7J�����wmi�WMI�sum�Win32_Processorr@rArB)rC�w�procss   r!�test_cpu_count_logical_vs_wmi�)TestCpuAPIs.test_cpu_count_logical_vs_wmizsH���G�G�I���
�78�7H�7H�7J�
�
��	
����)�)�+�U�3r c��[R"5n[SUR555nUR	[
R"SS9U5 g)Nc3�8# �UHoRv� M g7frR)�
NumberOfCoresrTs  r!rW�:TestCpuAPIs.test_cpu_count_cores_vs_wmi.<locals>.<genexpr>�s���G�3F�4�&�&�3F�rYF)�logicalrZ)rCr_�coress   r!�test_cpu_count_cores_vs_wmi�'TestCpuAPIs.test_cpu_count_cores_vs_wmi�sA���G�G�I���G�1�3D�3D�3F�G�G������)�)�%�8�%�@r c	��UR[R"5[[R"SS955 g)NT)�percpu)r@rArB�len�	cpu_times�rCs r!�test_cpu_count_vs_cpu_times�'TestCpuAPIs.test_cpu_count_vs_cpu_times�s.����������F�$4�$4�D�$A� B�	
r c�8�[R"5nUR5SnURUR[
R"5R5 URUR[
R"5R5 g�Nr)
r[r\r^r@�CurrentClockSpeedrA�cpu_freq�current�
MaxClockSpeed�max)rCr_rVs   r!�
test_cpu_freq�TestCpuAPIs.test_cpu_freq�sf���G�G�I��� � �"�1�%������/�/����1B�1J�1J�K�����+�+�V�_�_�->�-B�-B�Cr rN)rrrrr#�skipIfr>r?rErNrarirpryrrr r!r9r9hsG��
�_�_��b�j�j�0�7��7�	�7�2�4�A�

�
Dr r9c���\rSrSrSrSrSrSrSr\	R"\S5\"5S55r
\"5S	5r\"5S
5rSrSrS
rSrSrg)�TestSystemAPIs�c���[S5n[R"SS9R5nUHBnSUR	SS5R5;aM)X1;dM0UR
SU-5e g)Nz
ipconfig /allT)�perniczpseudo-interface� �-z-%r nic wasn't found in 'ipconfig /all' output)rrA�net_io_counters�keys�replace�lower�fail)rCr4�nics�nics    r!�test_nic_names�TestSystemAPIs.test_nic_names�sl����!���%�%�T�2�7�7�9���C�!�S�[�[��c�%:�%@�%@�%B�B���~��i�i�C�c�I���	r c���[R"5R5SnUR[	UR
5[R"5R5 grs)	r[r\�Win32_ComputerSystemr@r=�TotalPhysicalMemoryrA�virtual_memory�total�rCr_s  r!�test_total_phymem� TestSystemAPIs.test_total_phymem�sH���G�G�I�*�*�,�Q�/�������%�%�&��(=�(=�(?�(E�(E�	
r c���[R"5R5SnUR[	UR
5[R"5R[S9 g)Nr��delta)
r[r\�Win32_PerfRawData_PerfOS_Memory�assertAlmostEqualr=�AvailableBytesrAr��freerr�s  r!�test_free_phymem�TestSystemAPIs.test_free_phymem�sQ���G�G�I�5�5�7��:������� � �!��!�!�#�(�(�#�	�	
r c��[R"5R5SnUR[	UR
5[R"5R-
[R"5R5 [R"5RS:Xa_URS[R"5R5 URS[R"5R5 ggrs)r[r\r�r@r=�CommitLimitrAr�r��swap_memoryr��usedr�s  r!�test_total_swapmem�!TestSystemAPIs.test_total_swapmem�s����G�G�I�5�5�7��:�������
�
���!6�!6�!8�!>�!>�>���� �&�&�	
�����%�%��*����Q�� 2� 2� 4� 9� 9�:����Q�� 2� 2� 4� 9� 9�:�+r c�
�[R"5RS:�a�[R"5RSS9Sn[
UR5S-[
UR5-nUR[R"5RS5 UR[R"5RUSS9 UR[R"5RS5 gg)Nr�_Total)�Name�drHr�)
rAr�r�r[r\�#Win32_PerfRawData_PerfOS_PagingFiler=�PercentUsage�PercentUsage_Base�assertGreaterEqual�percentr��assertLessEqual)rCr_�percentSwaps   r!�test_percent_swapmem�#TestSystemAPIs.test_percent_swapmem�s�������%�%��)����	�=�=�8�=�L�Q�O�A��a�n�n�-��3�c�!�:M�:M�6N�N�K�
�#�#�F�$6�$6�$8�$@�$@�!�D��"�"��"�"�$�,�,�k��
#�
�
� � ��!3�!3�!5�!=�!=�s�C�*r ztest not relieable on appveyorc��[R"5R5n[UVs/sHo"RPM sn5n[[
R"55nURX45 gs snfrR)r[r\�
Win32_Process�set�	ProcessIdrA�pidsr@)rCr_r6�wmi_pids�psutil_pidss     r!�	test_pids�TestSystemAPIs.test_pids�sV��

�G�G�I�#�#�%���Q�/�Q����Q�/�0���&�+�+�-�(������/��0s�A9c�f�[R"SS9n[R"5R	5nUGH`nUGH;nUR
R
SS5UR:XdM0UR(d MJSUR;a M]URRS5(a M�[R"UR5nURUR[UR 55 [UR"5nURUR$U5 ['UR$U-
5S:�a#UR)SUR$<S	U<35e GMD UR)S
[+U5-5e g![a  GMuf=f)NT��all�\r)�cdrom�A:i�zpsutil=z, wmi=zcan't find partition %s)rA�disk_partitionsr[r\�Win32_LogicalDisk�devicer��DeviceID�
mountpoint�opts�
startswith�
disk_usagerr@r�r=�Size�	FreeSpacer��absr��repr)rC�ps_parts�	wmi_parts�ps_part�wmi_part�usage�wmi_frees       r!�
test_disks�TestSystemAPIs.test_disks�sT���)�)�d�3���G�G�I�/�/�1�	��G�%���>�>�)�)�$��3�x�7H�7H�H�"�-�-���'�,�,�.���)�)�4�4�T�:�:��� &� 1� 1�'�2D�2D� E���$�$�U�[�[�#�h�m�m�2D�E�"�8�#5�#5�6�H��$�$�U�Z�Z��:��5�:�:��0�1�4D�D�"�i�i�38�:�:�x�H����-&�0�i�i� 9�D��M� I�J�J�3 ��-����s�; F � 
F0�/F0c���[R"5H�nSUR;aM[R"UR
5n[R"UR
5nURUSUR[S9 URUSUR[S9 URURURUR-
5 M� g)Nr�rr�r*)
rAr�r�rI�GetDiskFreeSpaceExr�r�r�r�r
r�r@r�)rC�diskrLrMs    r!�test_disk_usage�TestSystemAPIs.test_disk_usage�s����*�*�,�D��$�)�)�#�� �3�3�D�O�O�D�I�!�,�,�T�_�_�=�L��"�"��!��l�/�/�7K�
#�
�
�"�"��!��l�0�0�8L�
#�
�
����!�!�<�#5�#5��8I�8I�#I�
�-r c��[R"5RS5Vs/sH)nU(dMURS5(aM$US-PM+ nn[R
"SS9Vs/sH1nURRS5(aM%URPM3 nnURX#5 gs snfs snf)Nz\r�r�Tr�)rI�GetLogicalDriveStringsr0r�rAr�r�r@)rCr6rLrMs    r!�test_disk_partitions�#TestSystemAPIs.test_disk_partitions	s����4�4�6�<�<�X�F�
�F���
����d�+�
�A��H�F�	�
��+�+��5�
�5���<�<�*�*�4�0�
�A�L�L�5�	�
�
	
����1��
��

s�B;�B;�	B;�/$C�Cc�N�[[R55n[R"5R5n[5nUH9nUR
UR5 UR
UR5 M; URX-SU<SU<35 g)Nzno common entries in z, )
r��cext�net_if_statsr[r\�Win32_NetworkAdapter�addr��NetConnectionID�
assertTrue)rC�ps_names�wmi_adapters�	wmi_names�wmi_adapters     r!�test_net_if_stats� TestSystemAPIs.test_net_if_statssz���t�(�(�*�+���w�w�y�5�5�7���E�	�'�K��M�M�+�*�*�+��M�M�+�5�5�6�(�	
���� �-5�y�A�	
r c��[R"5R5nUSRR	S5Sn[
R
R
US5n[
R
R[R"55n[X4-
R55nURUS5 g)Nr�.�%Y%m%d%H%M%SrH)
r[r\�Win32_OperatingSystem�LastBootUpTimer0�datetime�strptime�
fromtimestamprA�	boot_timer��
total_secondsr�)rC�wmi_os�
wmi_btime_str�wmi_btime_dt�	psutil_dt�diffs      r!�test_boot_time�TestSystemAPIs.test_boot_time"s�������0�0�2���q�	�0�0�6�6�s�;�A�>�
��(�(�1�1��>�
���%�%�3�3�F�4D�4D�4F�G�	��L�,�;�;�=�>�����T�1�%r c��[R"SSS9 UR[R"5S5 SSS5 [R"SSS9 UR[R"5S5 SSS5 [R"SSS9 UR[R"5S5 SSS5 [R"SSS9 UR[R"5S5 SSS5 g!,(df   N�=f!,(df   N�=f!,(df   Nt=f!,(df   g=f)Nz psutil._pswindows.cext.boot_timerH��return_value��iM)r�patchr@rAr�ros r!�test_boot_time_fluctuation�)TestSystemAPIs.test_boot_time_fluctuation,s���
�Z�Z�:��
K����V�-�-�/��3�L�
�Z�Z�:��
K����V�-�-�/��3�L�
�Z�Z�:��
K����V�-�-�/��3�L�
�Z�Z�:��
M����V�-�-�/��5�N�
M�
L�
K��
K�
K��
K�
K��
M�
M�s/�&D�&D�&D0�&E�
D�
D-�0
D>�
ErN)rrrrr�r�r�r�r�r#r{rrr�r�r�r�r�r�rrrr r!r}r}�s���	�
�
�;�D�2�_�_�X�?�@���0��A�0���K��K�<����� 2�

�&�	6r r}c��\rSrSrSr\R"\(+S5S5r\R"\(+S5S5r	Sr
SrSrS	r
S
rg)�TestSensorsBatteryi=c���[R"5S(a%UR[R"55 gUR[R"55 g)N�SystemBatteriesPresent)rI�GetPwrCapabilities�assertIsNotNonerA�sensors_battery�assertIsNoneros r!�test_has_battery�#TestSensorsBattery.test_has_battery>sB���&�&�(�)A�B�� � ��!7�!7�!9�:����f�4�4�6�7r z
no batteryc���[R"5nURS5Sn[R"5nURURURSS9 g)N�select * from Win32_Batteryrr*r�)r[r\�queryrArr�r��EstimatedChargeRemaining�rCr_�battery_wmi�battery_psutils    r!�test_percent�TestSensorsBattery.test_percentDsW���G�G�I���g�g�;�<�Q�?���/�/�1������"�"��0�0��	�	
r c���[R"5nURS5Sn[R"5nURURURS:H5 g)Nr
r�)r[r\rrArr@�
power_plugged�
BatteryStatusrs    r!�test_power_plugged�%TestSensorsBattery.test_power_pluggedOsU���G�G�I���g�g�;�<�Q�?���/�/�1��	
����(�(�+�*C�*C�q�*H�	
r c���[R"SSS9nUR[R"55 UR
(deSSS5 g!,(df   g=f)N�&psutil._pswindows.cext.sensors_battery)r�rrr�)rr�r	rAr�called�rC�ms  r!�test_emulate_no_battery�*TestSensorsBattery.test_emulate_no_batteryZsK��
�Z�Z�4�'�
�����f�4�4�6�7��8�8�O�8�
�
�
�s�8A�
A&c��[R"SSS9nUR[R"5R
[R5 UR(deSSS5 g!,(df   g=f)Nr)r*rrrr��rr�r@rAr�secsleft�POWER_TIME_UNLIMITEDrrs  r!�test_emulate_power_connected�/TestSensorsBattery.test_emulate_power_connectedb�[��
�Z�Z�4�<�
�
�����&�&�(�1�1�6�3N�3N�
��8�8�O�8�

�
�
���AA1�1
A?c��[R"SSS9nUR[R"5R
[R5 UR(deSSS5 g!,(df   g=f)Nr)r�rrr�r$rs  r!�test_emulate_power_charging�.TestSensorsBattery.test_emulate_power_chargingkr)r*c��[R"SSS9nUR[R"5R
[R5 UR(deSSS5 g!,(df   g=f)Nr)rrr���r�)rr�r@rArr%�POWER_TIME_UNKNOWNrrs  r!�test_emulate_secs_left_unknown�1TestSensorsBattery.test_emulate_secs_left_unknownts^��
�Z�Z�4�&�
������&�&�(�1�1�6�3L�3L�
��8�8�O�8�
�
�
�r*rN)rrrrr
r#r{r	rrr!r'r-r2rrr r!rr=s]��8��_�_��_�l�3�
�4�
��_�_��_�l�3�
�4�
����r rc��\rSrSr\S5r\S5rSrSrSr	Sr
SrS	rS
r
SrSrS
rSrSrSrSrSrSrg)�TestProcessi�c�6�[5RUlgrR�r�pid��clss r!�
setUpClass�TestProcess.setUpClass���� �"�&�&��r c�.�[UR5 grR�rr8r9s r!�
tearDownClass�TestProcess.tearDownClass�����#�'�'�r c��[R"S5nUR[RUR5 grs)rA�Process�assertRaises�AccessDenied�kill�rC�ps  r!�
test_issue_24�TestProcess.test_issue_24�s*���N�N�1������&�-�-�q�v�v�6r c��[R"S5nURUR5S5 [	U5 UR5 UR
UR5S5 UR5SSup#URUS5 g![Ra  [R"5SS;aegf=f)Nr��Systemgrrr*)�vistazwin-7�win7)
rArDr@�name�str�usernamer��create_time�memory_info�
assertGreaterrF�platform�uname)rCrI�rss�vmss    r!�test_special_pid�TestProcess.test_special_pid�s����N�N�1����������8�,�	�A��	�
�
������
�
���5�	'��}�}��r��*�H�C�
���s�A�&���"�"�	��~�~���"�*D�D��E�	�s�3B�1C�Cc��[R"UR5nUR[UR
[R5 grR)rArDr8rE�
ValueError�send_signal�signal�SIGINTrHs  r!�test_send_signal�TestProcess.test_send_signal�s.���N�N�4�8�8�$�����*�a�m�m�V�]�]�Cr c��[R"[R"55nUR	5n[
R"[R[R[R"55nUR	5nURXBS-5 [
R"U5 URUR	5U5 g)Nr*)rArDr>�getpid�num_handlesrI�OpenProcess�win32con�PROCESS_QUERY_INFORMATION�FALSEr@�CloseHandle)rCrI�before�handle�afters     r!�test_num_handles_increment�&TestProcess.test_num_handles_increment�s����N�N�2�9�9�;�'��������%�%��.�.�����	�	��
���
�
��������
�+����V�$��������&�1r c��[R"UR5R5nUR	[
R5 UR	[
R5 UR5 UR5 UR[RUR[
R5 UR[RUR[
R5 grR)rArDrr8r^r_�CTRL_C_EVENT�CTRL_BREAK_EVENTrG�waitrE�
NoSuchProcessrHs  r!�test_ctrl_signals�TestProcess.test_ctrl_signals�s����N�N�4�.�.�0�4�4�5��	�
�
�f�)�)�*�	�
�
�f�-�-�.�	����	�������� � �!�-�-��1D�1D�	
�	
���� � �!�-�-��1H�1H�	
r c�
�[R"[R5nUR	S5(a[
R"S5eUR[R"5R5U5 g)N�$zrunning as service account)rI�
GetUserNameExrg�NameSamCompatible�endswithr#r$r@rArDrR)rCrPs  r!�
test_username�TestProcess.test_username�s[���%�%�h�&@�&@�A���=�=�����#�#�$@�A�A�������)�2�2�4�d�;r c�N�[R"SS[R"55R	5nSR[R"5R55nUSSs=:Xa	US:waO OURSSS5nURX5 g)Nz[ ]+r�r�"r)r)�re�subrI�GetCommandLiner,r-rArDr&r�r@rKs   r!�test_cmdline�TestProcess.test_cmdline�s}���F�F�6�3��(?�(?�(A�B�H�H�J�	��x�x���� 0� 8� 8� :�;���Q�<�3�1�,�q�/�1�
"�)�)�#�r�1�5�I�����1r c�f�[R"[R[R[
R"55nUR[RU5 [R"U5n[R"5R5nURX25 grR)rIrfrgrhrir>rd�
addCleanuprj�win32process�GetPriorityClassrArD�nicer@�rCrlrLrMs    r!�	test_nice�TestProcess.test_nice�sr���%�%��.�.�����	�	��
��	
����,�,�f�5� �1�1�&�9�	��~�~�'�,�,�.������1r c���[R"[R[RUR
5nUR
[RU5 [R"U5n[R"UR
5R5nURUSUR5 URUSUR5 URUSUR 5 URUSUR"5 URUSUR$5 URUSUR&5 URUSUR(5 URUSUR*5 URUR,UR5 URUR.UR(5 g)	N�PeakWorkingSetSize�WorkingSetSize�QuotaPeakPagedPoolUsage�QuotaPagedPoolUsage�QuotaPeakNonPagedPoolUsage�QuotaNonPagedPoolUsage�
PagefileUsage�PeakPagefileUsage)rIrfrgrhrir8r�rjr��GetProcessMemoryInforArDrTr@�	peak_wset�wset�peak_paged_pool�
paged_pool�peak_nonpaged_pool�
nonpaged_pool�pagefile�
peak_pagefilerXrYr�s    r!�test_memory_info�TestProcess.test_memory_info�s����%�%��.�.�������
��	
����,�,�f�5� �5�5�f�=�	��~�~�d�h�h�/�;�;�=������*�+�\�-C�-C�	
�	
����#3�4�l�6G�6G�H�����/�0�,�2N�2N�	
�	
����+�,�l�.E�.E�	
�	
����2�3��+�+�	
�	
����.�/��1K�1K�	
�	
����?�3�\�5J�5J�K�����)�*�L�,F�,F�	
�	
����)�)�<�+<�+<�=�����)�)�<�+@�+@�Ar c��[R"[R[RUR
5nUR
[RU5 [R"UR
5nUR5 UR5n[R"U5nURX45 grR)rIrfrgrhrir8r�rjrArDrrsr��GetExitCodeProcessr@)rCrlrIrMrLs     r!�	test_wait�TestProcess.test_wait
s����%�%��.�.�������
��	
����,�,�f�5��N�N�4�8�8�$��	���
��v�v�x�� �3�3�F�;�	�����1r c��Sn[R"[R[RUR
5nUR
[RU5 U"[R"U5S5n[R"UR
5R5nURXC5 g)Nc�b�[S5Vs/sHnSU-U-(dMUPM sn$s snf)N�@r*)�range)r6�is  r!�from_bitmask�3TestProcess.test_cpu_affinity.<locals>.from_bitmasks(��$�R�y�9�y�!�Q�!�V�q�L�A�y�9�9��9s�,�,r)rIrfrgrhrir8r�rjr��GetProcessAffinityMaskrArD�cpu_affinityr@)rCr�rlrLrMs     r!�test_cpu_affinity�TestProcess.test_cpu_affinitys���	:��%�%��.�.�������
��	
����,�,�f�5� ��/�/��7��:�
�	��~�~�d�h�h�/�<�<�>������1r c��[R"[R[R[
R"55nUR[RU5 [R"U5n[R"5R5nURURUS5 URUR US5 URUR"US5 URUR$US5 URUR&US5 URUR(US5 g)N�ReadOperationCount�WriteOperationCount�ReadTransferCount�WriteTransferCount�OtherOperationCount�OtherTransferCount)rIrfrgrhrir>rdr�rjr��GetProcessIoCountersrArD�io_countersr@�
read_count�write_count�
read_bytes�write_bytes�other_count�other_bytesr�s    r!�test_io_counters�TestProcess.test_io_counters#s(���%�%��.�.�����	�	��
��	
����,�,�f�5� �5�5�f�=�	��~�~�'�3�3�5������#�#�Y�/C�%D�	
�	
����$�$�i�0E�&F�	
�	
����#�#�Y�/B�%C�	
�	
����$�$�i�0D�&E�	
�	
����$�$�i�0E�&F�	
�	
����$�$�i�0D�&E�	
r c��SSKnSSKnSnURRR	USUR
5nUR
URRRU5 URR5nURRRX1RU55 URn[R"UR
5R5nUR!Xe5 g)Nr�)�ctypes�ctypes.wintypes�windll�kernel32rfr8r�rj�wintypes�DWORD�GetProcessHandleCount�byref�valuerArDrer@)rCr�rhrl�hndcntrLrMs       r!�test_num_handles�TestProcess.test_num_handles=s�����$)�!����'�'�3�3�%�q�$�(�(�
��	
����
�
�.�.�:�:�F�C����&�&�(���
�
���4�4��L�L��(�	
��L�L�	��~�~�d�h�h�/�;�;�=������1r c��[5nSUl[R"SUS9 [R"S5n[R
"5nUR
[RUR5 SSS5 SSS5 URWRS5 g!,(df   N3=f!,(df   N<=f)Ni+z psutil._psplatform.cext.proc_cwd��side_effectz
time.sleeprH)�WindowsError�winerrorrr�rArDrErF�cwdr��
call_count)rC�excr rIs    r!�test_error_partial_copy�#TestProcess.test_error_partial_copyOs����n�����
�Z�Z�:��
L����L�)�Q��N�N�$���!�!�&�"5�"5�q�u�u�=�*�M�	
������a�0�*�)��M�
L�s#�B<�AB+�>B<�+
B9	�5B<�<
C
c���[R"5SS-n[RRU5nUR	[R
UR5 g)Nr0i��)rAr��_psplatformrDrErt�exe)rCr8rVs   r!�test_exe�TestProcess.test_exeYsI���k�k�m�B��%�'���!�!�)�)�#�.�����&�.�.����9r rN)rrrr�classmethodr;r@rJrZrarnrur|r�r�r�r�r�r�r�r�r�rrr r!r5r5�sv���'��'�����7�'�"D�	2�
�<�	2�42�B�@	2�2�
�42�$1�:r r5c��\rSrSrSr\S5r\S5rSr\	R"\S5S5rSr
S	r\"5S
5r\"5S5rSrS
rg)�TestProcessWMIiaz%Compare Process API results with WMI.c�6�[5RUlgrRr7r9s r!r;�TestProcessWMI.setUpClassdr=r c�.�[UR5 grRr?r9s r!r@�TestProcessWMI.tearDownClasshrBr c��[R"5RURS9Sn[R
"UR5nUR
UR5UR5 g�N�r�r)	r[r\r�r8rArDr@rP�Caption�rCr_rIs   r!�	test_name�TestProcessWMI.test_namelsP���G�G�I�#�#�d�h�h�#�7��:���N�N�4�8�8�$���������1�9�9�-r z!unreliable path on GITHUB_ACTIONSc�.�[R"5RURS9Sn[R
"UR5nUR
UR5R5URR55 gr�)
r[r\r�r8rArDr@r�r��ExecutablePathr�s   r!r��TestProcessWMI.test_exersc���G�G�I�#�#�d�h�h�#�7��:���N�N�4�8�8�$��	
����������!�*:�*:�*@�*@�*B�Cr c�4�[R"5RURS9Sn[R
"UR5nUR
SRUR55URRSS55 g)Nr�rr�rr))r[r\r�r8rArDr@r-r&�CommandLiner�r�s   r!r��TestProcessWMI.test_cmdlinezsf���G�G�I�#�#�d�h�h�#�7��:���N�N�4�8�8�$��������!�)�)�+�.��
�
�0E�0E�c�2�0N�Or c��[R"5RURS9Sn[R
"UR5nUR
5up4nU<SU<3nURUR5U5 g)Nr�rr�)	r[r\r�r8rArD�GetOwnerr@rR)rCr_rI�domain�_rRs      r!r|�TestProcessWMI.test_usernamesf���G�G�I�#�#�d�h�h�#�7��:���N�N�4�8�8�$���j�j�l���8�%�x�0���������x�0r c� �[R"5RURS9Sn[R
"UR5nUR
5RnURU[UR55 gr�)r[r\r�r8rArDrTrXr@r=r�)rCr_rIrXs    r!�test_memory_rss�TestProcessWMI.test_memory_rss�sb���G�G�I�#�#�d�h�h�#�7��:���N�N�4�8�8�$���m�m�o�!�!������c�!�"2�"2�3�4r c�F�[R"5RURS9Sn[R
"UR5nUR
5Rn[UR5nX4US-4;aURSU<SU<35eg)Nr�rr�zwmi=z	, psutil=)r[r\r�r8rArDrTrYr=�
PageFileUsager�)rCr_rIrY�	wmi_usages     r!�test_memory_vms�TestProcessWMI.test_memory_vms�s����G�G�I�#�#�d�h�h�#�7��:���N�N�4�8�8�$���m�m�o�!�!��
����(�	��)�d�"2�3�3��)�)�9�c�B�C�C�4r c��[R"5RURS9Sn[R
"UR5n[
URRS5S5n[R"S[R"UR555nURX45 g)Nr�rr�r�)r[r\r�r8rArDrQ�CreationDater0�time�strftime�	localtimerSr@)rCr_rI�wmic_create�
psutil_creates     r!�test_create_time�TestProcessWMI.test_create_time�s����G�G�I�#�#�d�h�h�#�7��:���N�N�4�8�8�$���!�.�.�.�.�s�3�A�6�7���
�
��D�N�N�1�=�=�?�;�
�
�	
����4r rN)rrrr�__doc__r�r;r@r�r#r{rr�r�r|rr�r�rrrr r!r�r�as���/��'��'�����.��_�_�^�%H�I�D�J�D�P�
1���5��5���
D��
D�5r r�c�\�\rSrSrSr\S5r\S5rSrSr	Sr
SrS	rS
r
Srg)
�TestDualProcessImplementationi�a[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.
c�6�[5RUlgrRr7r9s r!r;�(TestDualProcessImplementation.setUpClass�r=r c�.�[UR5 grRr?r9s r!r@�+TestDualProcessImplementation.tearDownClass�rBr c�j�[R"UR5R5n[R
"S[
[RS5S9n[R"UR5R5nUR[U5[U55 [[U55H@nURXS5 URX4S5 URXX4SS9 MB UR(deSSS5 g!,(df   g=f)Nz(psutil._psplatform.cext.proc_memory_info�msgr�rir�)rArDr8rTrr��OSError�errno�EPERMr@rmr�r�r�r)rC�mem_1�fun�mem_2r�s     r!r��.TestDualProcessImplementation.test_memory_info�s������t�x�x�(�4�4�6��
�Z�Z�6�����U�3�
���N�N�4�8�8�,�8�8�:�E����S��Z��U��4��3�u�:�&���'�'���!�4��'�'���!�4��&�&�u�x����&�E�'��:�:��:�
�
�
�s
�B>D$�$
D2c��[R"UR5R5n[R
"S[
[RS5S9nUR[R"UR5R5U5 UR(deSSS5 g!,(df   g=f)N�"psutil._psplatform.cext.proc_timesrr�)rArDr8rSrr�rrrr@r)rC�ctimers   r!r�.TestDualProcessImplementation.test_create_time�s������t�x�x�(�4�4�6��
�Z�Z�0�����U�3�
�����V�^�^�D�H�H�5�A�A�C�U�K��:�:��:�
�
�
��
�AB8�8
Cc��[R"UR5R5n[R
"S[
[RS5S9n[R"UR5R5nUR(deURURURSS9 URURURSS9 SSS5 g!,(df   g=f)Nrrr�g{�G�z�?r�)
rArDr8rnrr�rrrrr��user�system)rC�cpu_times_1r�cpu_times_2s    r!�test_cpu_times�,TestDualProcessImplementation.test_cpu_times�s����n�n�T�X�X�.�8�8�:��
�Z�Z�0�����U�3�
�� �.�.����2�<�<�>�K��:�:��:��"�"�� � �+�"2�"2�$�
#�
�
�"�"��"�"�K�$6�$6�d�
#�
�
�
�
�s
�BC1�1
C?c���[R"UR5R5n[R
"S[
[RS5S9n[R"UR5R5n[[U55HnURXX4SS9 M UR(deSSS5 g!,(df   g=f)Nz(psutil._psplatform.cext.proc_io_countersrr�rHr�)
rArDr8r�rr�rrrr�rmr�r)rC�
io_counters_1r�
io_counters_2r�s     r!r��.TestDualProcessImplementation.test_io_counters�s������t�x�x�0�<�<�>�
�
�Z�Z�6�����U�3�
��"�N�N�4�8�8�4�@�@�B�M��3�}�-�.���&�&�!�$�m�&6�a�'��/��:�:��:�
�
�
�s
�A2C�
C&c��[R"UR5R5n[R
"S[
[RS5S9nUR[R"UR5R5U5 UR(deSSS5 g!,(df   g=f)Nz(psutil._psplatform.cext.proc_num_handlesrr�)rArDr8rerr�rrrr@r)rCrers   r!r��.TestDualProcessImplementation.test_num_handles�s����n�n�T�X�X�.�:�:�<��
�Z�Z�6�����U�3�
��������t�x�x�(�4�4�6��
��:�:��:�
�
�
�rc�V�[R"5H=n[RUSS9n[RUSS9nUR	X#5 M? g![
aFn[
U5n[U[R[R45(deSnAM�SnAff=f)NT)�use_pebF)
rAr�r��proc_cmdliner@rr�
isinstancerFrt)rCr8�a�b�errs     r!r��*TestDualProcessImplementation.test_cmdline�s����;�;�=�C�

'��%�%�c�4�%�8���%�%�c�5�%�9��� � ��&�!���
�%�c�*��!��&�-�-�v�/C�/C�D������
�s�(A�
B(�";B#�#B(rN)rrrrrr�r;r@r�rr"r�r�r�rrr r!r
r
�sM����'��'�������
��	�'r r
c�t^�\rSrSrSr\S5rSS/rU4SjrU4Sjr	Sr
S	rS
rSr
SrS
rSrU=r$)�RemoteProcessTestCaseiz�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.
c�(�Sn[R"S5Hvn[R"USU/[R[RS9nUR5up4UR
5 U[[(+5:XdMtUs $ g)Nz6import sys; sys.stdout.write(str(sys.maxsize > 2**32))zC:\Python*\python.exe�-c)�args�stdout�stderr)	�glob�
subprocess�Popen�PIPE�STDOUT�communicatersrQr
)�code�filenamerV�outputr�s     r!�find_other_interpreter�,RemoteProcessTestCase.find_other_interpretersy��H���	�	�":�;�H��#�#���d�+�!���!�(�(��D�
�(�(�*�I�F��I�I�K����\�*�*���<r r5zimport sys; sys.stdin.read()c�z>�[5R5 UR5nUc[R"S5e[
(a[RUlXl	OXl[RUl	[RR5n[[R"55US'URUR/UR -U["R$S9UlURUR/UR -U["R$S9Ulg)Nz0could not find interpreter with opposite bitness�THINK_OF_A_NUMBER)�env�stdin)r�setUprBr#r$r
�sys�
executable�python64�python32r>r?�copyrQrdr�	test_argsr:r<�proc32�proc64)rC�other_pythonrF�	__class__s   �r!rH�RemoteProcessTestCase.setUp#s����
��
�
���2�2�4�����#�#�B��
��8��N�N�D�M�(�M�(�M��N�N�D�M��j�j�o�o���#&�r�y�y�{�#3��� ��)�)�
�]�]�O�d�n�n�,�#�Z�_�_�*�
����)�)�
�]�]�O�d�n�n�,�#�Z�_�_�*�
��r c�>�[5R5 URR5 URR5 grR)r�tearDownrOr>rP)rCrRs �r!rU�RemoteProcessTestCase.tearDown;s1���
����������!������!r c��[R"URR5nUR	[UR
55S5 UR	UR
5SSUR5 g�N�r*)rArDrOr8r@rmr&rNrHs  r!�test_cmdline_32�%RemoteProcessTestCase.test_cmdline_32@�S���N�N�4�;�;�?�?�+������Q�Y�Y�[�)�1�-��������Q�R��$�.�.�9r c��[R"URR5nUR	[UR
55S5 UR	UR
5SSUR5 grX)rArDrPr8r@rmr&rNrHs  r!�test_cmdline_64�%RemoteProcessTestCase.test_cmdline_64Er\r c��[R"URR5nUR	UR5[R"55 grR)rArDrOr8r@r�r>�getcwdrHs  r!�test_cwd_32�!RemoteProcessTestCase.test_cwd_32J�4���N�N�4�;�;�?�?�+���������"�)�)�+�.r c��[R"URR5nUR	UR5[R"55 grR)rArDrPr8r@r�r>rarHs  r!�test_cwd_64�!RemoteProcessTestCase.test_cwd_64Nrdr c��[R"URR5nUR	5nURSU5 UR
US[[R"555 g)NrE)
rArDrOr8r?�assertInr@rQr>rd)rCrI�es   r!�test_environ_32�%RemoteProcessTestCase.test_environ_32RsS���N�N�4�;�;�?�?�+��
�I�I�K���
�
�)�1�-�����.�/��R�Y�Y�[�1A�Br c��[R"URR5nUR	5 g![R
a gf=frR)rArDrPr8r?rFrHs  r!�test_environ_64�%RemoteProcessTestCase.test_environ_64Xs>���N�N�4�;�;�?�?�+��	�
�I�I�K���"�"�	��	�s�=�A�A)rOrPrLrK)rrrrr�staticmethodrBrNrHrUrZr^rbrfrkrnr�
__classcell__)rRs@r!r3r3sW����� �� �"�5�6�I�
�0"�
:�
:�
/�/�C��r r3c� �\rSrSrSrSrSrg)�TestServicesiec��[/SQ5n[/SQ5n[/SQ5n[R"5GH�nUR5nUR	US[
5 UR
USR5S5 UR	US[
5 UR	US[
5 URUSU5 US	b[R"US	5 UR	US
[
5 UR	US[
5 UR	US[
5 URUSU5 URUSU5 UR	US[
5 UR5nUb5[R"U5nURUR55 [R"UR55nURX75 GM� g)
N)�running�paused�start�pause�continue�stop�stopped)�	automatic�manual�disabled)rurv�
start_pending�
pause_pending�continue_pending�stop_pendingr{rPr)�display_namerR�statusr8�binpath�
start_type�description)r�rA�win_service_iter�as_dict�assertIsInstancerQ�assertNotEqualr,rirDr8r��
is_running�win_service_getrPr@)rC�valid_statuses�valid_start_types�servr5r8rI�ss        r!�test_win_service_iter�"TestServices.test_win_service_itergs����
��� � C�D���
����+�+�-�D��<�<�>�D��!�!�$�v�,��4�����V�� 2� 2� 4�b�9��!�!�$�~�"6��<��!�!�$�z�"2�C�8��M�M�$�x�.�.�9��E�{�&����t�E�{�+��!�!�$�y�/�3�7��!�!�$�z�"2�C�8��!�!�$�|�"4�c�:��M�M�$�|�,�.?�@��M�M�$�x�.�.�9��!�!�$�}�"5�s�;��(�(�*�C����N�N�3�'���������/��&�&�t�y�y�{�3�A����T�%�-.r c��[RRRn[RRRn[[R"55R5nUR[R5n[R"US-5 SSS5 URWRRUS-5 [R"U5n[(aSSSU4nOUS4n[U6n[R "SUS9 UR[RUR"5 SSS5 [R "SUS9 UR[RUR$5 SSS5 [(aSSSU4nOUS4n[U6n[R "SUS9 UR[R&UR"5 SSS5 [R "SUS9 UR[R&UR$5 SSS5 UR)UR5[+U55 UR)UR-5[+U55 UR)UR5[/U55 UR)UR-5[/U55 g!,(df   GNO=f!,(df   GN�=f!,(df   GN�=f!,(df   GN2=f!,(df   N�=f)Nz???rrz/psutil._psplatform.cext.winservice_query_statusr�z/psutil._psplatform.cext.winservice_query_config)rAr�r��ERROR_SERVICE_DOES_NOT_EXIST�ERROR_ACCESS_DENIED�nextr�rPrErtr�r@�	exceptionrr�rr�r�rRrFrirQr�r�)rCr�r�rP�cm�servicer6r�s        r!�test_win_service_get�!TestServices.test_win_service_get�so�����#�#�@�@�	%�%�0�0�5�5�I�I���F�+�+�-�.�3�3�5��
�
�
�v�3�3�
4���"�"�4�%�<�0�5�������*�*�D�5�L�9��(�(��.���3��u�a�!=�>�D�0�%�8�D��D�!��
�Z�Z�=�3�
�
���f�2�2�G�N�N�C�
��Z�Z�=�3�
�
���f�2�2�G�4D�4D�E�
��3��u�a�!4�5�D�'��/�D��D�!��
�Z�Z�=�3�
�
���f�1�1�7�>�>�B�
��Z�Z�=�3�
�
���f�1�1�7�3C�3C�D�
�	
�
�
�g�l�l�n�c�'�l�3��
�
�g�*�*�,�c�'�l�;��
�
�g�l�l�n�d�7�m�4��
�
�g�*�*�,�d�7�m�<�O5�
4��
�
��
�
��
�
��
�
�s<�K6�(+L�0+L�+L,�+L>�6
L�
L�
L)�,
L;�>
MrN)rrrrr�r�rrr r!rsrses
��*&�X.=r rs�__main__)�
run_from_name)=rr�rr9r>rVr�r_r:rIrr#�warningsrAr�psutil._compatrrr�psutil.testsrrr	r
rrr
rrrrrrr�catch_warnings�simplefilterrIrgr�r[�psutil._pswindowsrr�r�r{rr'r=r7r9r}rr5r�r
r3rsr�psutil.tests.runnerr��__file__rr r!�<module>r�s������	��	�
��
����
��,� � �!�'�$�!���-�*�'��)��'�"��4�	�	 �	 �	"����h�'�����
#��1�������
���W��n�-�	����6�7�	����+��G�-M�N�	�n�	�O�8�.�	�� #��,'D�/�'D�Tc6�_�c6�V?��?�NZ:�/�Z:�z@5�_�@5�L
���W��n�-�\'�N�\'�.�\'�~
���W��n�-�U�N�U�.�U�z
���W��n�-�[=�>�[=�.�[=�|�z��1��(���o
#�	"�s�#H8�8
I

Filemanager

Name Type Size Permission Actions
__init__.cpython-313.pyc File 91.2 KB 0644
__main__.cpython-313.pyc File 295 B 0644
runner.cpython-313.pyc File 17.87 KB 0644
test_aix.cpython-313.pyc File 5.58 KB 0644
test_bsd.cpython-313.pyc File 35.72 KB 0644
test_connections.cpython-313.pyc File 28.36 KB 0644
test_contracts.cpython-313.pyc File 23.74 KB 0644
test_linux.cpython-313.pyc File 138.04 KB 0644
test_memleaks.cpython-313.pyc File 34.66 KB 0644
test_misc.cpython-313.pyc File 54.59 KB 0644
test_osx.cpython-313.pyc File 11.29 KB 0644
test_posix.cpython-313.pyc File 24.29 KB 0644
test_process.cpython-313.pyc File 98.9 KB 0644
test_process_all.cpython-313.pyc File 25.5 KB 0644
test_sunos.cpython-313.pyc File 2.33 KB 0644
test_system.cpython-313.pyc File 56.49 KB 0644
test_testutils.cpython-313.pyc File 29.34 KB 0644
test_unicode.cpython-313.pyc File 17.55 KB 0644
test_windows.cpython-313.pyc File 57.12 KB 0644
Filemanager