o
    ¯b=  ã                   @   sx   d Z ddlZddlmZ ddlmZ zddlmZmZ dZ	W n e
y)   dZ	Y nw dd„ Zd	d
„ ZG dd„ deƒZdS )z.
Tests for L{twisted.internet.kqueuereactor}.
é    N)Úimplementer)ÚTestCase)ÚKQueueReactorÚ_IKQueuezKQueue not available.c                  O   s   dS )z
    Do nothing.
    N© )ÚargsÚkwargsr   r   úJ/usr/lib/python3/dist-packages/twisted/internet/test/test_kqueuereactor.pyÚ_fakeKEvent   s    r
   c                    s"   t tƒG ‡ ‡fdd„dƒƒ}|ƒ S )a  
    Create a fake that implements L{_IKQueue}.

    @param testKQueue: Something that acts like L{select.kqueue}.
    @param testKEvent: Something that acts like L{select.kevent}.
    @return: An implementation of L{_IKQueue} that includes C{testKQueue} and
        C{testKEvent}.
    c                       s   e Zd Z”Z” ZdS )z"makeFakeKQueue.<locals>.FakeKQueueN)Ú__name__Ú
__module__Ú__qualname__ÚkqueueÚkeventr   ©Ú
testKEventÚ
testKQueuer   r	   Ú
FakeKQueue&   s    r   )r   r   )r   r   r   r   r   r	   ÚmakeFakeKQueue   s   
r   c                   @   s   e Zd ZdZeZdd„ ZdS )ÚKQueueTestsz¯
    These are tests for L{KQueueReactor}'s implementation, not its real world
    behaviour. For that, look at
    L{twisted.internet.test.reactormixins.ReactorBuilder}.
    c                 C   s*   G dd„ dƒ}t t|tƒƒ}| d¡ dS )zV
        L{KQueueReactor} handles L{errno.EINTR} in C{doKEvent} by returning.
        c                   @   s   e Zd ZdZdd„ ZdS )z*KQueueTests.test_EINTR.<locals>.FakeKQueuez™
            A fake KQueue that raises L{errno.EINTR} when C{control} is called,
            like a real KQueue would if it was interrupted.
            c                 _   s   t tjdƒ‚)NÚInterrupted)ÚOSErrorÚerrnoÚEINTR)Úselfr   r   r   r   r	   ÚcontrolB   s   z2KQueueTests.test_EINTR.<locals>.FakeKQueue.controlN)r   r   r   Ú__doc__r   r   r   r   r	   r   <   s    r   r   N)r   r   r
   ÚdoKEvent)r   r   Úreactorr   r   r	   Ú
test_EINTR7   s   	zKQueueTests.test_EINTRN)r   r   r   r   Ú
kqueueSkipÚskipr   r   r   r   r	   r   .   s    r   )r   r   Úzope.interfacer   Útwisted.trial.unittestr   Útwisted.internet.kqreactorr   r   r    ÚImportErrorr
   r   r   r   r   r   r	   Ú<module>   s   ÿ