관리-도구
편집 파일: test_contracts.cpython-311.pyc
� �܋fel � �� � 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'� � Z3d.� Z4e. G d/� d0e'� � � � Z5e6d1k rdd2l7m8Z8 e8e9� � dS dS )3z�Contracts tests. These tests mainly check API sanity in terms of returned types and APIs availability. Some of these are duplicates of tests test_system.py and test_process.py � N)�AIX)�BSD)�FREEBSD)�LINUX)�MACOS)�NETBSD)�OPENBSD)�OSX)�POSIX)�SUNOS)�WINDOWS)�FileNotFoundError)�long)�range)�unicode)�APPVEYOR)� CI_TESTING)�GITHUB_ACTIONS)�HAS_CPU_FREQ)�HAS_NET_IO_COUNTERS)�HAS_SENSORS_FANS)�HAS_SENSORS_TEMPERATURES)�PYPY)�SKIP_SYSCONS)�VALID_PROC_STATUSES)�PsutilTestCase)�check_connection_ntuple)�create_sockets)�enum)� is_namedtuple)�kernel_version)�process_namespace)� serialrunc �^ � e Zd Zd� Zd� Zd� Zd� Z ej e oe d� � d� � � ZdS )�TestAvailConstantsAPIsc �~ � | � t t d� � t p t pt � � d S )N�PROCFS_PATH)�assertEqual�hasattr�psutilr r r ��selfs �n/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/psutil/tests/test_contracts.py�test_PROCFS_PATHz'TestAvailConstantsAPIs.test_PROCFS_PATHD s= � �������7�7��.�%�.�3� 0� 0� 0� 0� 0� c �� � | j } |t t d� � t � � |t t d� � t � � |t t d� � t � � |t t d� � t � � |t t d� � t � � |t t d� � t � � d S )N�ABOVE_NORMAL_PRIORITY_CLASS�BELOW_NORMAL_PRIORITY_CLASS�HIGH_PRIORITY_CLASS�IDLE_PRIORITY_CLASS�NORMAL_PRIORITY_CLASS�REALTIME_PRIORITY_CLASS�r( r) r* r �r, �aes r- �test_win_priorityz(TestAvailConstantsAPIs.test_win_priorityH s� � � � �� ��7�6�8�9�9�7�C�C�C� ��7�6�8�9�9�7�C�C�C� ��7�6�0�1�1�7�;�;�;� ��7�6�0�1�1�7�;�;�;� ��7�6�2�3�3�W�=�=�=� ��7�6�4�5�5�w�?�?�?�?�?r/ c �4 � | j } |t t d� � t � � |t t d� � t � � |t t d� � t � � |t t d� � t � � d S )N�IOPRIO_CLASS_NONE�IOPRIO_CLASS_RT�IOPRIO_CLASS_BE�IOPRIO_CLASS_IDLE�r( r) r* r r8 s r- �test_linux_ioprio_linuxz.TestAvailConstantsAPIs.test_linux_ioprio_linuxQ s� � � � �� ��7�6�.�/�/��7�7�7� ��7�6�,�-�-�u�5�5�5� ��7�6�,�-�-�u�5�5�5� ��7�6�.�/�/��7�7�7�7�7r/ c �4 � | j } |t t d� � t � � |t t d� � t � � |t t d� � t � � |t t d� � t � � d S )N�IOPRIO_HIGH� IOPRIO_NORMAL� IOPRIO_LOW�IOPRIO_VERYLOWr7 r8 s r- �test_linux_ioprio_windowsz0TestAvailConstantsAPIs.test_linux_ioprio_windowsX s� � � � �� ��7�6�=�)�)�7�3�3�3� ��7�6�?�+�+�W�5�5�5� ��7�6�<�(�(�'�2�2�2� ��7�6�+�,�,�g�6�6�6�6�6r/ �%unsupported on GITHUB_ACTIONS + LINUXc � � | j } |t t d� � t pt � � |t t d� � t pt � � |t t d� � t pt � � |t t d� � t pt � � |t t d� � t pt � � |t t d� � t pt � � |t t d� � t pt � � |t t d� � t pt � � |t t d � � t pt � � |t t d � � t pt � � |t t d� � t pt � � |t t d� � t � � t �rt � � d k r$ |t t d� � t � � t � � dk r$ |t t d� � t � � t � � dk r$ |t t d� � t � � t � � dk r$ |t t d� � t � � t � � d k r$ |t t d� � t � � |t t d� � t � � |t t d� � t � � |t t d� � t � � d S )N� RLIM_INFINITY� RLIMIT_AS�RLIMIT_CORE� RLIMIT_CPU�RLIMIT_DATA�RLIMIT_FSIZE�RLIMIT_MEMLOCK� RLIMIT_NOFILE�RLIMIT_NPROC� RLIMIT_RSS�RLIMIT_STACK�RLIMIT_LOCKS)� � � �RLIMIT_MSGQUEUE)rV rW � �RLIMIT_NICE� RLIMIT_RTPRIO)rV rW � � RLIMIT_RTTIME�RLIMIT_SIGPENDING�RLIMIT_SWAP� RLIMIT_SBSIZE�RLIMIT_NPTS)r( r) r* r r r r! r8 s r- �test_rlimitz"TestAvailConstantsAPIs.test_rlimit_ s� � � � �� ��7�6�?�+�+�U�-=�g�>�>�>� ��7�6�;�'�'��)9�'�:�:�:� ��7�6�=�)�)�5�+;�G�<�<�<� ��7�6�<�(�(�%�*:�7�;�;�;� ��7�6�=�)�)�5�+;�G�<�<�<� ��7�6�>�*�*�E�,<�W�=�=�=� ��7�6�+�,�,�e�.>�w�?�?�?� ��7�6�?�+�+�U�-=�g�>�>�>� ��7�6�>�*�*�E�,<�W�=�=�=� ��7�6�<�(�(�%�*:�7�;�;�;� ��7�6�>�*�*�E�,<�W�=�=�=� ��7�6�>�*�*�E�2�2�2�� @����9�,�,���7�6�#4�5�5�u�=�=�=����:�-�-���7�6�=�1�1�5�9�9�9����:�-�-���7�6�?�3�3�U�;�;�;����:�-�-���7�6�?�3�3�U�;�;�;����9�,�,���7�6�#6�7�7��?�?�?� ��7�6�=�)�)�7�3�3�3� ��7�6�?�+�+�W�5�5�5� ��7�6�=�)�)�7�3�3�3�3�3r/ N)�__name__� __module__�__qualname__r. r: rA rG �unittest�skipIfr r rc � r/ r- r% r% B s� � � � � � �0� 0� 0�@� @� @�8� 8� 8�7� 7� 7� �X�_�^�-��<�>� >�4� 4�>� >�4� 4� 4r/ r% c �2 � e Zd Zd� Zd� Zd� Zd� Zd� Zd� ZdS )�TestAvailSystemAPIsc �b � | � t t d� � t � � d S )N�win_service_iterr7 r+ s r- �test_win_service_iterz)TestAvailSystemAPIs.test_win_service_iter� s) � ������);�<�<�g�F�F�F�F�Fr/ c �b � | � t t d� � t � � d S )N�win_service_getr7 r+ s r- �test_win_service_getz(TestAvailSystemAPIs.test_win_service_get� s) � ������):�;�;�W�E�E�E�E�Er/ c � � | � t t d� � t pt pt p t pt � � d S )N�cpu_freq)r( r) r* r r r r r r+ s r- � test_cpu_freqz!TestAvailSystemAPIs.test_cpu_freq� sL � �������4�4��H�%�H�7�H�g�H�� J� J� J� J� Jr/ c �p � | � t t d� � t pt � � d S )N�sensors_temperatures)r( r) r* r r r+ s r- �test_sensors_temperaturesz-TestAvailSystemAPIs.test_sensors_temperatures� s>