관리-도구
편집 파일: test_system.cpython-311.pyc
� P�Dg� � �� � d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddlZddlmZ ddlm Z ddlmZ ddlmZ ddlmZ ddlmZ dd lmZ dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm 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. G d$� d%e)� � Z/ G d&� d'e)� � Z0 G d(� d)e)� � Z1 G d*� d+e)� � Z2 G d,� d-e)� � Z3 G d.� d/e)� � Z4 G d0� d1e)� � Z5e6d2k rdd3l7m8Z8 e8e9� � dS 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 � � e Zd Zd� Zd� Z ej eoed� � d� � � Z ej eoed� � d� � � Z d� Zd� ZdS ) �TestProcessAPIsc �h � | � t j � � d� t j � � D � � � � | � � � }| � |j d� t j � � D � � � � t j |j � � }|� � � |� � � | � |j d� t j � � D � � � � t j dt j t j � � � � �� � 5 | � t t j � � � � g � � d d d � � n# 1 swxY w Y t j dt j t j � � � � �� � 5 | � t j � � 5 t t j � � � � d d d � � n# 1 swxY w Y d d d � � d S # 1 swxY w Y d S )Nc � � g | ] }|j �� S � ��pid��.0�xs �z/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/psutil/tests/test_system.py� <listcomp>z5TestProcessAPIs.test_process_iter.<locals>.<listcomp>@ s � �#I�#I�#I�a�A�E�#I�#I�#I� c � � g | ] }|j �� S r( r) r+ s r. r/ z5TestProcessAPIs.test_process_iter.<locals>.<listcomp>B s � �!G�!G�!G�A�!�%�!G�!G�!Gr0 c � � g | ] }|j �� S r( r) r+ s r. r/ z5TestProcessAPIs.test_process_iter.<locals>.<listcomp>F s � �$J�$J�$J�q�Q�U�$J�$J�$Jr0 zpsutil.Process��side_effect)�assertIn�os�getpid�psutil�process_iter�spawn_testprocr* �Process�kill�wait�assertNotInr �patch� NoSuchProcess�assertEqual�list�AccessDenied�assertRaises��self�sproc�ps r. �test_process_iterz!TestProcessAPIs.test_process_iter? s� � �� � �b�i�k�k�#I�#I�6�3F�3H�3H�#I�#I�#I�J�J�J��#�#�%�%��� � �e�i�!G�!G��1D�1F�1F�!G�!G�!G�H�H�H��N�5�9�%�%�� ������ �����������$J�$J�F�4G�4I�4I�$J�$J�$J�K�K�K� �Z�(�$*�$8�����$E�$E�G� G� G� >� >����T�&�"5�"7�"7�8�8�"�=�=�=� >� >� >� >� >� >� >� >� >� >� >���� >� >� >� >� �Z�(�$*�$7�� ���$D�$D�F� F� F� ,� ,��"�"�6�#6�7�7� ,� ,��V�(�*�*�+�+�+� ,� ,� ,� ,� ,� ,� ,� ,� ,� ,� ,���� ,� ,� ,� ,� ,� ,� ,� ,� ,� ,� ,� ,� ,� ,� ,� ,���� ,� ,� ,� ,� ,� ,sH �=5E>�>F�F� H'�"!H�H'�H �H'�H �H'�'H+�.H+c � � t j dg�� � D ]=}| � t |j � � � � � dg� � �>| � t � � 5 t t j dg�� � � � d d d � � n# 1 swxY w Y t j dt j dd� � �� � 5 }t j ddg�� � D ]C}| � |j d � � | � |j d d� � �D|j sJ � d d d � � n# 1 swxY w Y t j dt j dd� � �� � 5 }t � � }t j ddg|� � � D ]D}| � |j d |� � | � |j d d� � �E|j sJ � d d d � � d S # 1 swxY w Y d S ) Nr* )�attrs�fooz$psutil._psplatform.Process.cpu_timesr � r3 � cpu_times)rK �ad_value)r8 r9 rA rB �info�keysrD � ValueErrorr r? rC �assertIsNone�assertGreaterEqual�called�object�assertIs)rF rH �m�flags r. �test_prcess_iter_w_attrsz(TestProcessAPIs.test_prcess_iter_w_attrsP s� � ��$�E�7�3�3�3� ;� ;�A����T�!�&�+�+�-�-�0�0�5�'�:�:�:�:� � � �z� *� *� 5� 5���$�E�7�3�3�3�4�4�4� 5� 5� 5� 5� 5� 5� 5� 5� 5� 5� 5���� 5� 5� 5� 5� �Z�>�$*�$7��2�$>�$>�@� @� @� �CD��(��{�/C�D�D�D� :� :���!�!�!�&��"5�6�6�6��'�'���u� �q�9�9�9�9��8�O�O�8�O� � � � � � � � � � � ���� � � � � �Z�>�$*�$7��2�$>�$>�@� @� @� �CD��8�8�D��(� �+�.��?� ?� ?� :� :��� � �a�f�[�1�4�8�8�8��'�'���u� �q�9�9�9�9��8�O�O�8�O� � � � � � � � � � � � ���� � � � � � s8 �/$B�B#�&B#�A%E�E �E �9A5G<�<H �H z-spawn_testproc() unreliable on PYPY + WINDOWSc � � �� �fd�}g �� � � � }� � � � }� � � � }d� |||fD � � }� � t t j |d�� � � � t t j |d�� � t j � � }t j |d|�� � \ }}� � t j � � |z d � � � � |g � � � � t |� � d � � � � �g � � |D ]%} � � t | d� � � � �&t d� � � fd �� � } |� � � | ||� � \ }}� � |j d� |D � � � � t r9� � |� � � j t&