Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3/dist-packages/twisted/internet/test/__pycache__/ |
Upload File : |
o �b�H � @ sx d Z ddlZddlmZmZ ddlmZmZ ddlm Z ddl mZ e d�dur/ddlmZ ndZG d d � d ej �ZdS )z? Tests for the inotify wrapper in L{twisted.internet.inotify}. � N)�defer�reactor)�filepath�runtime)� requireModule)�unittestztwisted.python._inotify)�inotifyc @ s e Zd ZdZej�� s dZdd� Zdd� Z d<dd �Z d d� Zdd � Zdd� Z dd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� Zd.d/� Zd0d1� Zd2d3� Zd4d5� Z d6d7� Z!d8d9� Z"d:d;� Z#dS )=�INotifyTestsz] Define all the tests for the basic functionality exposed by L{inotify.INotify}. z&This platform doesn't support INotify.c C s@ t �| �� �| _| j�� t�� | _| j�� | �| jj � d S �N) r �FilePath�mktemp�dirname�createDirectoryr �INotify�startReading� addCleanup�loseConnection��self� r �D/usr/lib/python3/dist-packages/twisted/internet/test/test_inotify.py�setUp s zINotifyTests.setUpc C s4 G dd� d�}| � tjd|� � | �tjtj� dS )a L{inotify.INotify} emits a C{RuntimeError} when initialized in an environment that doesn't support inotify as we expect it. We just try to raise an exception for every possible case in the for loop in L{inotify.INotify._inotify__init__}. c @ s e Zd Zdd� ZdS )z;INotifyTests.test_initializationErrors.<locals>.FakeINotifyc S s t �� �r )r �INotifyErrorr r r r �init. s z@INotifyTests.test_initializationErrors.<locals>.FakeINotify.initN)�__name__� __module__�__qualname__r r r r r �FakeINotify- s r �_inotifyN)�patchr r �assertRaisesr )r r r r r �test_initializationErrors$ s z&INotifyTests.test_initializationErrorsNc s` � du r �j �d�� t�� �� ��fdd�}��|� �jj�j ��fdd�gd� |� � �S )a� Test notification from some filesystem operation. @param mask: The event mask to use when setting up the watch. @param operation: A function which will be called with the name of a file in the watched directory and which should trigger the event. @param expectedPath: Optionally, the name of the path which is expected to come back in the notification event; this will also be passed to C{operation} (primarily useful when the operation is being done to the directory itself, not a file in it). @return: A L{Deferred} which fires successfully when the expected event has been received or fails otherwise. Nzfoo.barc s0 | \}}}�� |�� � �� � ��|�@ � d S r )�assertEqual�asBytesMode� assertTrue��result�watch�filename�events)�expectedPath�maskr r r � cbNotifiedK s z2INotifyTests._notificationTest.<locals>.cbNotifiedc � � � | �S r ��callback��args��notifiedr r �<lambda>S � z0INotifyTests._notificationTest.<locals>.<lambda>�r+ � callbacks)r �childr �Deferred�addCallbackr r'