Ϫf~dZddlmZddlmZddlmZ ddlmZeZ e r(ejrddl m Z mZmZddlmZmZmZmZndZ Gd d eZy#e $rdZ YAwxYw) z' Tests for L{twisted.python._inotify}. )FilePath)platform)TestCase)_inotifyN)c_char_pc_intc_uint32) INotifyErroraddinitinitializeModulec<eZdZdZedZdZdZdZdZ dZ d Z y) INotifyTestsz/ Tests for L{twisted.python._inotify}. Nz&This platform doesn't support INotify.cXGdd}|jtt|y)z If the I{libc} object passed to L{initializeModule} has no C{inotify_init} attribute, L{ImportError} is raised. ceZdZdZdZy)+INotifyTests.test_missingInit..libccyNselfs B/usr/lib/python3/dist-packages/twisted/python/test/test_inotify.pyinotify_add_watchz=INotifyTests.test_missingInit..libc.inotify_add_watch*cyrrrs rinotify_rm_watchz.libc.inotify_rm_watch-rrN)__name__ __module__ __qualname__rrrrrlibcr)   rr!N assertRaises ImportErrorr rr!s rtest_missingInitzINotifyTests.test_missingInit##    +'7@rcXGdd}|jtt|y)z If the I{libc} object passed to L{initializeModule} has no C{inotify_add_watch} attribute, L{ImportError} is raised. ceZdZdZdZy)*INotifyTests.test_missingAdd..libccyrrrs r inotify_initz7INotifyTests.test_missingAdd..libc.inotify_init9rrcyrrrs rrz;INotifyTests.test_missingAdd..libc.inotify_rm_watch<rrN)rrr r-rrrrr!r+8r"rr!Nr#r&s rtest_missingAddzINotifyTests.test_missingAdd2r(rcXGdd}|jtt|y)z If the I{libc} object passed to L{initializeModule} has no C{inotify_rm_watch} attribute, L{ImportError} is raised. ceZdZdZdZy)-INotifyTests.test_missingRemove..libccyrrrs rr-z:INotifyTests.test_missingRemove..libc.inotify_initHrrcyrrrs rrz?INotifyTests.test_missingRemove..libc.inotify_add_watchKrrN)rrr r-rrrrr!r2Gr"rr!Nr#r&s rtest_missingRemovezINotifyTests.test_missingRemoveAr(rcNGdd}|}t||j|jjg|j|jjt |j|j jt t g|j|j jt |j|jjt ttg|j|jjt y)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. cNeZdZdZeeZdZeeZdZeeZy)(INotifyTests.test_setTypes..libccyrrrs rr-z5INotifyTests.test_setTypes..libc.inotify_initXrrcyrrrs rrz9INotifyTests.test_setTypes..libc.inotify_rm_watch]rrcyrrrs rrz:INotifyTests.test_setTypes..libc.inotify_add_watchbrrN)rrr r- staticmethodrrrrrr!r8Ws9 ( 5L  ,,<=  !--> ? rr!N) r assertEqualr-argtypesrestyperrrrr )rr!cs r test_setTypeszINotifyTests.test_setTypesPs @ @ F 00"5 //7 ++44uenE ++33U; ,,55x7RS ,,44e.libccyNrrs rr-z7INotifyTests.test_failedInit..libc.inotify_inityrN)rrr r-rrrr!rDx rr!N)patchinotifyr$r r r&s rtest_failedInitzINotifyTests.test_failedInitrs0    7FDF+ ,-rcGdd}|jtd||jttdt ddy)zk If C{inotify_add_watch} returns a negative number, L{add} raises L{INotifyError}. ceZdZdZy).INotifyTests.test_failedAddWatch..libccyrFr)rfdpathmasks rrz@INotifyTests.test_failedAddWatch..libc.inotify_add_watchrHrN)rrr rrrrr!rOrIrr!z/foorN)rJrKr$r r rr&s rtest_failedAddWatchz INotifyTests.test_failedAddWatchs;    7FDF+ ,Q0@!Dr) rrr __doc__rKskipr'r/r5rArLrUrrrrrs67 A A A =D . Err)rVtwisted.python.filepathrtwisted.python.runtimertwisted.trial.unittestrtwisted.pythonrrKr%supportsINotifyctypesrrr twisted.python._inotifyr r r r rrrrr_sl-++'G 'x'')00QQGoE8oEGsAA A