AlkantarClanX12
Current Path : /opt/alt/python39/lib64/python3.9/unittest/__pycache__/ |
Current File : //opt/alt/python39/lib64/python3.9/unittest/__pycache__/_log.cpython-39.opt-1.pyc |
a R�f� � @ sR d dl Z d dlZddlmZ e�dddg�ZG dd� de j�ZG d d � d e�ZdS )� N� )�_BaseTestCaseContext�_LoggingWatcher�records�outputc @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �_CapturingHandlerzM A logging handler capturing all (raw and formatted) logging output. c C s t j�| � tg g �| _d S �N)�logging�Handler�__init__r �watcher��self� r �2/opt/alt/python39/lib64/python3.9/unittest/_log.pyr s z_CapturingHandler.__init__c C s d S r r r r r r �flush s z_CapturingHandler.flushc C s* | j j�|� | �|�}| j j�|� d S r )r r �append�formatr )r �record�msgr r r �emit s z_CapturingHandler.emitN)�__name__� __module__�__qualname__�__doc__r r r r r r r r s r c @ s, e Zd ZdZdZdd� Zdd� Zdd� Zd S ) �_AssertLogsContextz:A context manager used to implement TestCase.assertLogs().z"%(levelname)s:%(name)s:%(message)sc C s: t �| |� || _|r(tj�||�| _ntj| _d | _d S r ) r r �logger_namer Z_nameToLevel�get�level�INFOr )r Z test_caser r r r r r ! s z_AssertLogsContext.__init__c C s� t | jtj�r| j }| _nt�| j� }| _t�| j�}t� }|� |� |j | _ |jd d � | _|j | _|j| _|g|_|�| j � d|_|j S )NF)� isinstancer r ZLogger�loggerZ getLoggerZ Formatter�LOGGING_FORMATr ZsetFormatterr �handlers�old_handlersr � old_level� propagate� old_propagate�setLevel)r r! Z formatterZhandlerr r r � __enter__* s z_AssertLogsContext.__enter__c C s` | j | j_| j| j_| j�| j� |d ur.dS t| jj �dkr\| � d�t� | j�| jj�� d S )NFr z-no logs of level {} or higher triggered on {})r$ r! r# r'