Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/twisted/test/__pycache__/test_logfile.cpython-39.pyc
Ðазад
a k�h�E � @ s� d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZm Z d dl mZ G dd� de�ZG dd� dej �ZG d d � d e�ZdS )� N)�skipIf)�logfile�runtime)�TestCasec @ s� e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zeej�� d�dd � �Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)S )*�LogFileTestsz% Test the rotating log file. c C s4 | � � | _t�| j� d| _tj�| j| j�| _d S )Nztest.log��mktemp�dir�os�makedirs�name�path�join��self� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/twisted/test/test_logfile.py�setUp s zLogFileTests.setUpc C s. t �| jd� t j�| j�r*t �| jd� dS )z� Restore back write rights on created paths: if tests modified the rights, that will allow the paths to be removed easily afterwards. � N)r �chmodr r �existsr r r r �tearDown s zLogFileTests.tearDownc C s. t �| j| j�}| �|j� | �t|j� dS )zf L{BaseLogFile.shouldRotate} is abstract and must be implemented by subclass. N) r ZBaseLogFiler r � addCleanup�close�assertRaises�NotImplementedErrorZshouldRotate�r �logr r r �test_abstractShouldRotate$ s z&LogFileTests.test_abstractShouldRotatec C s� t �t�| j| j���6}|�d� |�d� |�� |�d� W d � n1 sR0 Y t| j �� }| � |�� d� W d � n1 s�0 Y dS )zn Log files can be written to, flushed and closed. Closing a log file also flushes it. �123�456�7890N� 1234567890)� contextlib�closingr �LogFiler r �write�flush�openr �assertEqual�read�r r �fr r r �test_writing- s (zLogFileTests.test_writingc C s` t �tj| j| jdd����}|�d� |�d� |�d� | �tj � | j � d��� | �tj � | j � d��� |�d� | �tj � | j � d��� | �tj � | j � d��� | �tj � | j � d ��� |�d � | �tj � | j � d ��� |�� | �tj � | j � d ��� | �tj � | j � d��� W d � n1 �s>0 Y | � |�� g d �� dS )zq Rotating log files autorotate after a period of time, and can also be manually rotated. � )�rotateLengthr �4567890�11111111111�.1�.2� �.3�3�.4N)� � � )r# r$ r r% r r r&