관리-도구
편집 파일: test_misc.cpython-36.opt-1.pyc
3 ��JZ�� � @ s| d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl mZ ddl mZ ddl m Z 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. dd$lm/Z/ dd%lm0Z0 dd&lm1Z1 dd'lm2Z2 dd(lm3Z3 dd)lm4Z4 dd*lm5Z5 dd+lm6Z6 dd,lm7Z7 dd-lm8Z8 dd.lm9Z9 dd/lm:Z: dd0lm;Z; dd1lm<Z< ddl Z ddlZ G d2d3� d3e8j=�Z>ej?d4d5�Z@G d6d7� d7e8j=�ZAe8jBe6d8�e8jBe7�o�ejCjDe2� d9�G d:d;� d;e8j=���ZEG d<d=� d=e8j=�ZFG d>d?� d?e8j=�ZGG d@dA� dAe8j=�ZHG dBdC� dCe8j=�ZIG dDdE� dEe8j=�ZJG dFdG� dGe8j=�ZKeLdHk�rxe0eM� dS )Iz Miscellaneous tests. � N)�LINUX)�POSIX)�WINDOWS)�memoize)�memoize_when_activated)� supports_ipv6)�wrap_numbers)�PY3)�APPVEYOR)�bind_socket)�bind_unix_socket)� call_until)�chdir)�create_proc_children_pair)�create_sockets)�create_zombie_proc)�DEVNULL)� get_free_port)�get_test_subprocess)�HAS_BATTERY)�HAS_CONNECTIONS_UNIX)�HAS_MEMORY_FULL_INFO)�HAS_MEMORY_MAPS)�HAS_SENSORS_BATTERY)�HAS_SENSORS_FANS)�HAS_SENSORS_TEMPERATURES)�import_module_by_path)� is_namedtuple)�mock)� PYTHON_EXE)� reap_children)� reload_module)�retry)�ROOT_DIR)�run_test_module_by_name)�safe_rmpath)�SCRIPTS_DIR)�sh)�tcp_socketpair)�TESTFN)�TOX)�TRAVIS)�unittest)�unix_socket_path)�unix_socketpair)� wait_for_file)�wait_for_pidc @ s� e Zd Zefdd�Zdd� Zefdd�Zefdd�Zefd d �Zefdd�Z d d� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)S )*�TestMiscc C sn t j� }||�}| jd|� | jd|j |� | jd|� | j|j� |� tjjt jdt jt j � �d��@ t j� }||�}| jd|j |� | jd|� | jd|� W d Q R X tjjt jdt jt j � �d��@ t j� }||�}| jd|j |� | jd|� | jd|� W d Q R X tjjt jdt j t j � �d��4 t j� }||�}| jd|j |� | jd|� W d Q R X d S )Nzpsutil.Processzpid=%szname=�name)�side_effectZzombieZ terminated)�psutil�Process�assertIn�pidr2 r �patch�object� ZombieProcess�os�getpid�assertNotIn� NoSuchProcess�AccessDenied)�self�func�p�r� rD �!/usr/lib64/python3.6/test_misc.py�test_process__repr__O s4 zTestMisc.test_process__repr__c C s | j td� d S )N)rA )rF �str)r@ rD rD rE �test_process__str__k s zTestMisc.test_process__str__c C sN | j ttjd��d� | j ttjddd��d� | j ttjddd��d� d S )NiA z7psutil.NoSuchProcess process no longer exists (pid=321)�foo)r2 zCpsutil.NoSuchProcess process no longer exists (pid=321, name='foo'))�msgzpsutil.NoSuchProcess foo)�assertEqual�reprr4 r>