관리-도구
편집 파일: test_contracts.cpython-38.pyc
U �Mg!1 � @ s� d Z ddlZddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z dd lm Z dd lmZ ddlmZ ddl mZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ G dd� de�ZG dd� de�ZG dd � d e�Z G d!d"� d"e�Z!G d#d$� d$e�Z"dS )%z�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)�FREEBSD)�LINUX)�MACOS)�NETBSD)�OPENBSD)�POSIX)�SUNOS)�WINDOWS)�long)�GITHUB_ACTIONS)�HAS_CPU_FREQ)�HAS_NET_IO_COUNTERS)�HAS_SENSORS_FANS)�HAS_SENSORS_TEMPERATURES)�PYPY)� QEMU_USER)�SKIP_SYSCONS)�PsutilTestCase)�create_sockets)�enum)� is_namedtuple)�kernel_version)�pytestc @ sH e Zd Zdd� Zdd� Zdd� Zdd� Zejj e o4ed d �dd� �Zd S )�TestAvailConstantsAPIsc C s t td�tptptkst�d S )NZPROCFS_PATH)�hasattr�psutilr r r �AssertionError��self� r �K/opt/hc_python/lib64/python3.8/site-packages/psutil/tests/test_contracts.py�test_PROCFS_PATH3 s z'TestAvailConstantsAPIs.test_PROCFS_PATHc C sj | j }|ttd�t� |ttd�t� |ttd�t� |ttd�t� |ttd�t� |ttd�t� d S )NZABOVE_NORMAL_PRIORITY_CLASSZBELOW_NORMAL_PRIORITY_CLASSZHIGH_PRIORITY_CLASSZIDLE_PRIORITY_CLASSZNORMAL_PRIORITY_CLASSZREALTIME_PRIORITY_CLASS��assertEqualr r r �r Zaer r r! �test_win_priority6 s z(TestAvailConstantsAPIs.test_win_priorityc C sJ | j }|ttd�t� |ttd�t� |ttd�t� |ttd�t� d S )NZIOPRIO_CLASS_NONEZIOPRIO_CLASS_RTZIOPRIO_CLASS_BEZIOPRIO_CLASS_IDLE)r$ r r r r% r r r! �test_linux_ioprio_linux? s z.TestAvailConstantsAPIs.test_linux_ioprio_linuxc C sJ | j }|ttd�t� |ttd�t� |ttd�t� |ttd�t� d S )NZIOPRIO_HIGHZ IOPRIO_NORMALZ IOPRIO_LOWZIOPRIO_VERYLOWr# r% r r r! �test_linux_ioprio_windowsF s z0TestAvailConstantsAPIs.test_linux_ioprio_windows�%unsupported on GITHUB_ACTIONS + LINUX��reasonc C s� | j }|ttd�tpt� |ttd�tp*t� |ttd�tp>t� |ttd�tpRt� |ttd�tpft� |ttd�tpzt� |ttd�tp�t� |ttd�tp�t� |ttd �tp�t� |ttd �tp�t� |ttd�tp�t� |ttd�t� t�r�t� d k�r|ttd�t� t� dk�r0|ttd�t� t� dk�rL|ttd�t� t� dk�rh|ttd�t� t� d k�r�|ttd�t� |ttd�t� |ttd�t� |ttd�t� d S )NZ RLIM_INFINITYZ RLIMIT_ASZRLIMIT_COREZ RLIMIT_CPUZRLIMIT_DATAZRLIMIT_FSIZEZRLIMIT_MEMLOCKZ RLIMIT_NOFILEZRLIMIT_NPROCZ RLIMIT_RSSZRLIMIT_STACKZRLIMIT_LOCKS)� � � ZRLIMIT_MSGQUEUE)r, r- � ZRLIMIT_NICEZ RLIMIT_RTPRIO)r, r- � Z RLIMIT_RTTIMEZRLIMIT_SIGPENDINGZRLIMIT_SWAPZ RLIMIT_SBSIZEZRLIMIT_NPTS)r$ r r r r r r r% r r r! �test_rlimitM s6 z"TestAvailConstantsAPIs.test_rlimitN) �__name__� __module__�__qualname__r"