HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/twisted/python/test/__pycache__/test_inotify.cpython-38.pyc
U


W[7�@s�dZddlmZddlmZddlmZe��rjddlm	Z	m
Z
mZddlm
Z
ddlmZmZmZmZndZ
Gd	d
�d
e�ZdS)z'
Tests for L{twisted.python._inotify}.
�)�TestCase)�FilePath)�platform)�c_int�c_uint32�c_char_p)�_inotify)�INotifyError�initializeModule�init�addNc@sLeZdZdZedkrdZdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdS)�INotifyTestsz/
    Tests for L{twisted.python._inotify}.
    Nz&This platform doesn't support INotify.cCs"Gdd�d�}|�tt|��dS)z�
        If the I{libc} object passed to L{initializeModule} has no
        C{inotify_init} attribute, L{ImportError} is raised.
        c@seZdZdd�Zdd�ZdS)z+INotifyTests.test_missingInit.<locals>.libccSsdS�N���selfrr�B/usr/lib/python3/dist-packages/twisted/python/test/test_inotify.py�inotify_add_watch#sz=INotifyTests.test_missingInit.<locals>.libc.inotify_add_watchcSsdSrrrrrr�inotify_rm_watch%sz<INotifyTests.test_missingInit.<locals>.libc.inotify_rm_watchN)�__name__�
__module__�__qualname__rrrrrr�libc"srN��assertRaises�ImportErrorr
�rrrrr�test_missingInitszINotifyTests.test_missingInitcCs"Gdd�d�}|�tt|��dS)z�
        If the I{libc} object passed to L{initializeModule} has no
        C{inotify_add_watch} attribute, L{ImportError} is raised.
        c@seZdZdd�Zdd�ZdS)z*INotifyTests.test_missingAdd.<locals>.libccSsdSrrrrrr�inotify_init0sz7INotifyTests.test_missingAdd.<locals>.libc.inotify_initcSsdSrrrrrrr2sz;INotifyTests.test_missingAdd.<locals>.libc.inotify_rm_watchN)rrrrrrrrrr/srNrrrrr�test_missingAdd*szINotifyTests.test_missingAddcCs"Gdd�d�}|�tt|��dS)z�
        If the I{libc} object passed to L{initializeModule} has no
        C{inotify_rm_watch} attribute, L{ImportError} is raised.
        c@seZdZdd�Zdd�ZdS)z-INotifyTests.test_missingRemove.<locals>.libccSsdSrrrrrrr=sz:INotifyTests.test_missingRemove.<locals>.libc.inotify_initcSsdSrrrrrrr?sz?INotifyTests.test_missingRemove.<locals>.libc.inotify_add_watchN)rrrrrrrrrr<srNrrrrr�test_missingRemove7szINotifyTests.test_missingRemovecCs�Gdd�d�}|�}t|�|�|jjg�|�|jjt�|�|jjttg�|�|jjt�|�|jjttt	g�|�|jjt�dS)z�
        If the I{libc} object passed to L{initializeModule} has all of the
        necessary attributes, it sets the C{argtypes} and C{restype} attributes
        of the three ctypes methods used from libc.
        c@s<eZdZdd�Zee�Zdd�Zee�Zdd�Zee�ZdS)z(INotifyTests.test_setTypes.<locals>.libccSsdSrrrrrrrKsz5INotifyTests.test_setTypes.<locals>.libc.inotify_initcSsdSrrrrrrrOsz9INotifyTests.test_setTypes.<locals>.libc.inotify_rm_watchcSsdSrrrrrrrSsz:INotifyTests.test_setTypes.<locals>.libc.inotify_add_watchN)rrrr�staticmethodrrrrrrrJsrN)
r
ZassertEqualrZargtypesZrestyperrrrr)rr�crrr�
test_setTypesDs
�zINotifyTests.test_setTypescCs.Gdd�d�}|�td|��|�tt�dS)zg
        If C{inotify_init} returns a negative number, L{init} raises
        L{INotifyError}.
        c@seZdZdd�ZdS)z*INotifyTests.test_failedInit.<locals>.libccSsdS�N���rrrrrrjsz7INotifyTests.test_failedInit.<locals>.libc.inotify_initN)rrrrrrrrrisrN)�patchrrr	rrrrr�test_failedInitdszINotifyTests.test_failedInitcCs8Gdd�d�}|�td|��|�ttdtd�d�dS)zk
        If C{inotify_add_watch} returns a negative number, L{add}
        raises L{INotifyError}.
        c@seZdZdd�ZdS)z.INotifyTests.test_failedAddWatch.<locals>.libccSsdSr$r)r�fd�path�maskrrrrvsz@INotifyTests.test_failedAddWatch.<locals>.libc.inotify_add_watchN)rrrrrrrrrusr�z/foorN)r&rrr	rrrrrr�test_failedAddWatchpsz INotifyTests.test_failedAddWatch)rrr�__doc__r�skiprrr r#r'r,rrrrr
s


 r
)r-Ztwisted.trial.unittestrZtwisted.python.filepathrZtwisted.python.runtimerZsupportsINotifyZctypesrrrZtwisted.pythonrZtwisted.python._inotifyr	r
rrr
rrrr�<module>s