+
    üÐj&>  ã                  ó  € R t ^ RIHt ^ RIt^ RIt^ RIHtHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIHt ^ RIHt R	tR
t]P(                  ! 4       '       d   ]! R4      f   ]! R4      f   RtRt ! R R]4      t ! R R]4      tR# )z'
Tests for L{twisted.python.lockfile}.
)ÚannotationsN)ÚskipIfÚ
skipUnless)ÚNoReturn)Úlockfile)ÚrequireModule)Úplatform)ÚTestCaseFÚ zwin32api.OpenProcessÚ
pywintypesTzZOn windows, lockfile.kill is not implemented in the absence of win32api and/or pywintypes.c                  ó
  € ] tR t^#tRtR R lt]! ]P                  ! 4       R4      R R l4       t	R R lt
]! ]P                  ! 4       R	4      R
 R l4       t]! ]]4      R R l4       t]! ]]4      R R l4       tR R ltRtR# )Ú	UtilTestszE
Tests for the helper functions used to implement L{FilesystemLock}.
c               ó   € V ^8„  d   QhRR/# ©é   ÚreturnÚNone© )Úformats   "Ú</usr/lib/python3/dist-packages/twisted/test/test_lockfile.pyÚ__annotate__ÚUtilTests.__annotate__(   s   € ÷ 2ñ 2 Dñ 2ó    c                óô   € V P                  4       p\        P                  ! RV4       V P                  \        \        P                  RV4      pV P                  VP                  \        P                  4       R# )zˆ
L{lockfile.symlink} raises L{OSError} with C{errno} set to L{EEXIST}
when an attempt is made to create a symlink which already exists.
ÚfooN)Úmktempr   ÚsymlinkÚassertRaisesÚOSErrorÚassertEqualÚerrnoÚEEXIST©ÚselfÚnameÚexcs   &  r   Útest_symlinkEEXISTÚUtilTests.test_symlinkEEXIST(   sS   € ð
 �{‰{‹}ˆÜ×Ò˜ Ô%Ø×Ñ¤¬×)9Ñ)9¸5À$ÓGˆØ×Ñ˜Ÿ™¤E§L¡LÖ1r   úBspecial rename EIO handling only necessary and correct on Windows.c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   6   s   € ÷ /ñ /¨ñ /r   c                ó   € V P                  4       pR R lpV P                  \        RV4       V P                  \        \        P
                  VR4      pV P                  VP                  \        P                  4       R# )a  
L{lockfile.symlink} raises L{OSError} with C{errno} set to L{EIO} when
the underlying L{rename} call fails with L{EIO}.

Renaming a file on Windows may fail if the target of the rename is in
the process of being deleted (directory deletion appears not to be
atomic).
c               ó$   € V ^8„  d   QhRRRRRR/# ©r   ÚsrcÚstrÚdstr   r   r   )r   s   "r   r   Ú6UtilTests.test_symlinkEIOWindows.<locals>.__annotate__A   s!   € ÷ 	+ñ 	+˜Cð 	+ cð 	+¨hñ 	+r   c                ó6   € \        \        P                  R 4      h©N©r   r    ÚEIO©r-   r/   s   &&r   Ú
fakeRenameÚ4UtilTests.test_symlinkEIOWindows.<locals>.fakeRenameA   s   € Üœ%Ÿ)™) TÓ*Ð*r   Úrenamer   N)	r   Úpatchr   r   ÚIOErrorr   r   r    r4   )r#   r$   r6   r%   s   &   r   Útest_symlinkEIOWindowsÚ UtilTests.test_symlinkEIOWindows2   sZ   € ð �{‰{‹}ˆõ	+ð 	�
‰
”8˜X zÔ2Ø×Ñ¤¬×)9Ñ)9¸4ÀÓGˆØ×Ñ˜Ÿ™¤E§I¡IÖ.r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   H   s   € ÷ 2ñ 2 Tñ 2r   c                óÄ   € V P                  4       pV P                  \        \        P                  V4      pV P                  VP                  \        P                  4       R# )z‡
L{lockfile.readlink} raises L{OSError} with C{errno} set to L{ENOENT}
when an attempt is made to read a symlink which does not exist.
N)r   r   r   r   Úreadlinkr   r    ÚENOENTr"   s   &  r   Útest_readlinkENOENTÚUtilTests.test_readlinkENOENTH   sA   € ð
 �{‰{‹}ˆØ×Ñ¤¬×):Ñ):¸DÓAˆØ×Ñ˜Ÿ™¤E§L¡LÖ1r   úGspecial readlink EACCES handling only necessary and correct on Windows.c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   U   s   € ÷ 2ñ 2¨Dñ 2r   c                óþ   € V P                  4       pR R lpV P                  \        RV4       V P                  \        \        P
                  V4      pV P                  VP                  \        P                  4       R# )a,  
L{lockfile.readlink} raises L{OSError} with C{errno} set to L{EACCES}
on Windows when the underlying file open attempt fails with C{EACCES}.

Opening a file on Windows may fail if the path is inside a directory
which is in the process of being deleted (directory deletion appears
not to be atomic).
c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úpathr.   Úmoder   r   r   )r   s   "r   r   Ú:UtilTests.test_readlinkEACCESWindows.<locals>.__annotate__`   s!   € ÷ 	.ñ 	.˜3ð 	. cð 	.¨hñ 	.r   c                ó6   € \        \        P                  R 4      hr2   ©r   r    ÚEACCES)rG   rH   s   &&r   ÚfakeOpenÚ6UtilTests.test_readlinkEACCESWindows.<locals>.fakeOpen`   ó   € Üœ%Ÿ,™,¨Ó-Ð-r   Ú_openN)	r   r9   r   r   r:   r?   r   r    rL   )r#   r$   rM   r%   s   &   r   Útest_readlinkEACCESWindowsÚ$UtilTests.test_readlinkEACCESWindowsQ   sX   € ð �{‰{‹}ˆõ	.ð 	�
‰
”8˜W hÔ/Ø×Ñ¤¬×):Ñ):¸DÓAˆØ×Ñ˜Ÿ™¤E§L¡LÖ1r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   h   s   € ÷ &ñ &˜4ñ &r   c                óZ   € \         P                  ! \        P                  ! 4       ^ 4       R# )ze
L{lockfile.kill} returns without error if passed the PID of a
process which exists and signal C{0}.
N)r   ÚkillÚosÚgetpid©r#   s   &r   Ú	test_killÚUtilTests.test_killg   s   € ô 	�Š”b—i’i“k 1Ö%r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   p   s   € ÷ 1ñ 1 ñ 1r   c                ó¦   € V P                  \        \        P                  R^ 4      pV P	                  VP
                  \
        P                  4       R# )zu
L{lockfile.kill} raises L{OSError} with errno of L{ESRCH} if
passed a PID which does not correspond to any process.
Niÿÿÿ)r   r   r   rU   r   r    ÚESRCH)r#   r%   s   & r   Útest_killESRCHÚUtilTests.test_killESRCHo   s6   € ð ×Ñ¤¬¯©¸	À1ÓEˆØ×Ñ˜Ÿ™¤E§K¡KÖ0r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   y   s   € ÷ 	$ñ 	$ ñ 	$r   c                óÚ   € V P                  \        RR4       \        P                  ! V P                  4       4      pVP	                  4        V P                  VP	                  4       4       R# )z•
Verify that when L{lockfile.kill} does end up as None (e.g. on Windows
without pywin32), it doesn't end up being called and raising a
L{TypeError}.
rU   N)r9   r   ÚFilesystemLockr   ÚlockÚassertFalse)r#   Úfls   & r   Útest_noKillCallÚUtilTests.test_noKillCally   sG   € ð 	�
‰
”8˜V TÔ*Ü×$Ò$ T§[¡[£]Ó3ˆØ
�‰Œ	Ø×Ñ˜Ÿ™›Ö#r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r&   r   r   Ú	isWindowsr;   rA   rQ   r   ÚskipKillÚskipKillReasonrY   r^   rf   Ú__static_attributes__r   r   r   r   r   #   s¡   † ñõ2ñ Ø×ÒÓØOóô/ó	ð/õ$2ñ Ø×ÒÓØTóô2ó	ð2ñ$ ˆH�nÓ%ô&ó &ð&ñ ˆH�nÓ%ô1ó &ð1÷	$ñ 	$r   r   c                  óÆ  € ] tR t^…tR R ltR R lt]! ]P                  ! 4       R4      R R l4       t	R R	 lt
R
 R ltR R ltR R ltR R lt]! ]P                  ! 4       R4      R R l4       t]! ]P                  ! 4       R4      R R l4       tR R ltR R lt]! ]P                  ! 4       R4      R R l4       tR R ltR  R! ltR" R# ltR$ R% ltR& R' ltR(tR)# )*ÚLockingTestsc               ó    € V ^8„  d   QhRRRR/# )r   r    Úintr   r   r   )r   s   "r   r   ÚLockingTests.__annotate__†   s   € ÷ 	+ñ 	+ sð 	+¨tñ 	+r   c                	ó  a€ R  V3R llpV P                  \        RV4       V P                  4       p\        P                  ! V4      pV P	                  \
        VP                  4      pV P                  VP                  S4       R# )c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úsourcer.   Údestr   r   r   )r   s   "r   r   Ú4LockingTests._symlinkErrorTest.<locals>.__annotate__‡   s!   € ÷ 	'ñ 	' ð 	'¨3ð 	'°8ñ 	'r   c                ó   <€ \        SR 4      hr2   )r   )rx   ry   r    s   &&€r   ÚfakeSymlinkÚ3LockingTests._symlinkErrorTest.<locals>.fakeSymlink‡   s   ø€ Ü˜% Ó&Ð&r   r   N)	r9   r   r   rb   r   r   rc   r   r    )r#   r    r|   Úlockfrc   r%   s   &f    r   Ú_symlinkErrorTestÚLockingTests._symlinkErrorTest†   sd   ø€ ÷	'ð 	'ð 	�
‰
”8˜Y¨Ô4à—‘“ˆÜ×&Ò& uÓ-ˆØ×Ñ¤¨¯©Ó3ˆØ×Ñ˜Ÿ™ EÖ*r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   ‘   s   € ÷ -ñ - 4ñ -r   c                óD   € V P                  \        P                  4       R# )zn
An exception raised by C{symlink} other than C{EEXIST} is passed up to
the caller of L{FilesystemLock.lock}.
N)r   r    ÚENOSYSrX   s   &r   Útest_symlinkErrorÚLockingTests.test_symlinkError‘   s   € ð
 	×ÑœuŸ|™|Ö,r   z9POSIX-specific error propagation not expected on Windows.c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   œ   s   € ÷ 	*ñ 	*¨ñ 	*r   c                ó‚   € V P                  \        P                  4       V P                  \        P                  4       R# )zø
An L{OSError} raised by C{symlink} on a POSIX platform with an errno of
C{EACCES} or C{EIO} is passed to the caller of L{FilesystemLock.lock}.

On POSIX, unlike on Windows, these are unexpected errors which cannot
be handled by L{FilesystemLock}.
N)r   r    rL   r4   rX   s   &r   Útest_symlinkErrorPOSIXÚ#LockingTests.test_symlinkErrorPOSIX˜   s(   € ð 	×ÑœuŸ|™|Ô,Ø×ÑœuŸy™yÖ)r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   §   s   € ÷ 	%ñ 	% Tñ 	%r   c                óü   € V P                  4       p\        P                  ! V4      pV P                  VP	                  4       4       V P                  VP
                  4       V P                  VP                  4       R# )zs
If the lock has never been held, it can be acquired and the C{clean}
and C{locked} attributes are set to C{True}.
N)r   r   rb   Ú
assertTruerc   ÚcleanÚlocked©r#   r~   rc   s   &  r   Útest_cleanlyAcquireÚ LockingTests.test_cleanlyAcquire§   sQ   € ð
 —‘“ˆÜ×&Ò& uÓ-ˆØ�‰˜Ÿ	™	›Ô$Ø�‰˜Ÿ
™
Ô#Ø�‰˜Ÿ™Ö$r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   ²   s   € ÷ %ñ % Tñ %r   c                ó¼  € V P                  4       p\        P                  ! V4      pV P                  VP	                  4       4       VP                  4        V P                  VP                  4       \        P                  ! V4      pV P                  VP	                  4       4       V P                  VP                  4       V P                  VP                  4       R# )zt
If a lock is released cleanly, it can be re-acquired and the C{clean}
and C{locked} attributes are set to C{True}.
N)	r   r   rb   rŒ   rc   Úunlockrd   rŽ   r�   r�   s   &  r   Útest_cleanlyReleaseÚ LockingTests.test_cleanlyRelease²   sŽ   € ð
 —‘“ˆÜ×&Ò& uÓ-ˆØ�‰˜Ÿ	™	›Ô$Ø�‰ŒØ×Ñ˜Ÿ™Ô%ä×&Ò& uÓ-ˆØ�‰˜Ÿ	™	›Ô$Ø�‰˜Ÿ
™
Ô#Ø�‰˜Ÿ™Ö$r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   Â   s   € ÷ 
,ñ 
, tñ 
,r   c                ó0  € V P                  4       p\        P                  ! V4      pV P                  VP	                  4       4       \        P                  ! V4      pV P                  VP	                  4       4       V P                  VP                  4       R# )z;
If a lock is currently locked, it cannot be locked again.
N)r   r   rb   rŒ   rc   rd   rŽ   )r#   r~   Ú	firstLockÚ
secondLocks   &   r   Útest_cannotLockLockedÚ"LockingTests.test_cannotLockLockedÂ   sk   € ð —‘“ˆÜ×+Ò+¨EÓ2ˆ	Ø�‰˜	Ÿ™Ó(Ô)ä×,Ò,¨UÓ3ˆ
Ø×Ñ˜Ÿ™Ó*Ô+Ø×Ñ˜×*Ñ*Ö+r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   Î   s   € ÷ Eñ E tñ Er   c                ó  a€ RoR V3R llpV P                  4       pV P                  \        RV4       \        P                  ! \	        S4      V4       \        P
                  ! V4      pV P                  VP                  4       4       V P                  VP                  4       V P                  VP                  4       V P                  \        P                  ! V4      \	        \        P                  ! 4       4      4       R# )z§
If a lock was held by a process which no longer exists, it can be
acquired, the C{clean} attribute is set to C{False}, and the
C{locked} attribute is set to C{True}.
i90  c               ó$   € V ^8„  d   QhRRRRRR/# ©r   Úpidrt   Úsignalr   r   r   )r   s   "r   r   Ú8LockingTests.test_uncleanlyAcquire.<locals>.__annotate__Ö   ó!   € ÷ 	1ñ 	1˜#ð 	1 sð 	1¨tñ 	1r   c                óŒ   <€ V^ 8w  d   \        \        P                  R4      hV S8X  d   \        \        P                  R4      hR# )é    N©r   r    ÚEPERMr]   )r¡   r¢   Úowners   &&€r   ÚfakeKillÚ4LockingTests.test_uncleanlyAcquire.<locals>.fakeKillÖ   s8   ø€ Ø˜Œ{ÜœeŸk™k¨4Ó0Ð0Ø�eŒ|ÜœeŸk™k¨4Ó0Ð0ñ r   rU   N)r   r9   r   r   r.   rb   rŒ   rc   rd   r�   rŽ   r   r?   rV   rW   )r#   rª   r~   rc   r©   s   &   @r   Útest_uncleanlyAcquireÚ"LockingTests.test_uncleanlyAcquireÎ   s¯   ø€ ð ˆ÷	1ð 	1ð —‘“ˆØ�
‰
”8˜V XÔ.Ü×Òœ˜U› UÔ+ä×&Ò& uÓ-ˆØ�‰˜Ÿ	™	›Ô$Ø×Ñ˜Ÿ™Ô$Ø�‰˜Ÿ™Ô$à×Ñœ×*Ò*¨5Ó1´3´r·y²y³{Ó3CÖDr   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   ç   s   € ÷ %ñ %¨dñ %r   c                ó¼  aa€ R VV3R llpV P                  \        RV4      oR R lpV P                  \        RV4       V P                  4       o\        P                  ! S4      p\        P                  ! \        R4      S4       V P                  VP                  4       4       V P                  VP                  4       V P                  VP                  4       R# )	zÐ
If the lock is initially held but then released before it can be
examined to determine if the process which held it still exists, it is
acquired and the C{clean} and C{locked} attributes are set to C{True}.
c               ó    € V ^8„  d   QhRRRR/# )r   r$   r.   r   r   )r   s   "r   r   Ú?LockingTests.test_lockReleasedBeforeCheck.<locals>.__annotate__î   s   € ÷ 	+ñ 	+˜sð 	+ sñ 	+r   c                ó|   <€ \         P                  ! S4       SP                  4        \         P                  ! V 4      # r2   )r   ÚrmlinkÚrestorer?   )r$   r~   ÚreadlinkPatchs   &€€r   ÚfakeReadlinkÚ?LockingTests.test_lockReleasedBeforeCheck.<locals>.fakeReadlinkî   s,   ø€ ä�OŠO˜EÔ"à×!Ñ!Ô#Ü×$Ò$ TÓ*Ð*r   r?   c               ó$   € V ^8„  d   QhRRRRRR/# r    r   )r   s   "r   r   r±   ÷   r¤   r   c                óŠ   € V^ 8w  d   \        \        P                  R4      hV R8X  d   \        \        P                  R4      hR# ©r¦   Néu¨  r§   ©r¡   r¢   s   &&r   rª   Ú;LockingTests.test_lockReleasedBeforeCheck.<locals>.fakeKill÷   ó7   € Ø˜Œ{ÜœeŸk™k¨4Ó0Ð0Ø�eŒ|ÜœeŸk™k¨4Ó0Ð0ñ r   rU   r»   N©
r9   r   r   rb   r   r.   rŒ   rc   r�   rŽ   )r#   r¶   rª   rc   r~   rµ   s   &   @@r   Útest_lockReleasedBeforeCheckÚ)LockingTests.test_lockReleasedBeforeCheckç   s™   ù€ ÷	+ñ 	+ð Ÿ
™
¤8¨Z¸ÓFˆõ	1ð 	�
‰
”8˜V XÔ.à—‘“ˆÜ×&Ò& uÓ-ˆÜ×Òœ˜U› UÔ+Ø�‰˜Ÿ	™	›Ô$Ø�‰˜Ÿ
™
Ô#Ø�‰˜Ÿ™Ö$r   r(   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   
  s   € ÷ &ñ &°tñ &r   c                ó   € R R lpV P                  \        RV4       V P                  4       p\        P                  ! V4      pV P	                  VP                  4       4       V P	                  VP                  4       R# )a[  
If the lock is released while an attempt is made to acquire
it, the lock attempt fails and C{FilesystemLock.lock} returns
C{False}.  This can happen on Windows when L{lockfile.symlink}
fails with L{IOError} of C{EIO} because another process is in
the middle of a call to L{os.rmdir} (implemented in terms of
RemoveDirectory) which is not atomic.
c               ó$   € V ^8„  d   QhRRRRRR/# r,   r   )r   s   "r   r   ÚHLockingTests.test_lockReleasedDuringAcquireSymlink.<locals>.__annotate__  s!   € ÷ 	+ñ 	+˜Sð 	+ sð 	+¨xñ 	+r   c                ó6   € \        \        P                  R 4      hr2   r3   r5   s   &&r   r|   ÚGLockingTests.test_lockReleasedDuringAcquireSymlink.<locals>.fakeSymlink  s   € ô œ%Ÿ)™) TÓ*Ð*r   r   N)r9   r   r   rb   rd   rc   rŽ   )r#   r|   r~   rc   s   &   r   Ú%test_lockReleasedDuringAcquireSymlinkÚ2LockingTests.test_lockReleasedDuringAcquireSymlink  sZ   € õ	+ð
 	�
‰
”8˜Y¨Ô4à—‘“ˆÜ×&Ò& uÓ-ˆØ×Ñ˜Ÿ™›Ô%Ø×Ñ˜Ÿ™Ö%r   rC   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   $  s   € ÷ &ñ &¸ñ &r   c                ó@  € R R lpV P                  \        RV4       V P                  4       p\        P                  ! V4      p\        P                  ! \        R4      V4       V P                  VP                  4       4       V P                  VP                  4       R# )z›
If the lock is initially held but is released while an attempt
is made to acquire it, the lock attempt fails and
L{FilesystemLock.lock} returns C{False}.
c               ó    € V ^8„  d   QhRRRR/# ©r   r$   r.   r   r   r   )r   s   "r   r   ÚILockingTests.test_lockReleasedDuringAcquireReadlink.<locals>.__annotate__+  s   € ÷ 	.ñ 	.˜sð 	. xñ 	.r   c                ó6   € \        \        P                  R 4      hr2   rK   ©r$   s   &r   r¶   ÚILockingTests.test_lockReleasedDuringAcquireReadlink.<locals>.fakeReadlink+  s   € ô œ%Ÿ,™,¨Ó-Ð-r   r?   r»   N)	r9   r   r   rb   r   r.   rd   rc   rŽ   )r#   r¶   r~   rc   s   &   r   Ú&test_lockReleasedDuringAcquireReadlinkÚ3LockingTests.test_lockReleasedDuringAcquireReadlink   sn   € õ	.ð 	�
‰
”8˜Z¨Ô6à—‘“ˆÜ×&Ò& uÓ-ˆÜ×Òœ˜U› UÔ+Ø×Ñ˜Ÿ™›Ô%Ø×Ñ˜Ÿ™Ö%r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   ÚexceptionTypeztype[OSError] | type[IOError]r    rt   r   r   r   )r   s   "r   r   ru   9  s$   € ÷ &ñ &Ø:ð&ØCFð&à	ñ&r   c                	ó~  aa€ R  VV3R llpV P                  \        RV4       V P                  4       p\        P                  ! \	        R4      V4       \        P
                  ! V4      pV P                  SVP                  4      pV P                  VP                  S4       V P                  VP                  4       R# )c               ó    € V ^8„  d   QhRRRR/# rÍ   r   )r   s   "r   r   Ú5LockingTests._readlinkErrorTest.<locals>.__annotate__<  s   € ÷ 	-ñ 	-˜sð 	- xñ 	-r   c                ó   <€ S! SR 4      hr2   r   )r$   r    rÕ   s   &€€r   r¶   Ú5LockingTests._readlinkErrorTest.<locals>.fakeReadlink<  s   ø€ Ù  tÓ,Ð,r   r?   r»   N)r9   r   r   r   r.   rb   r   rc   r   r    rd   rŽ   )r#   rÕ   r    r¶   r~   rc   r%   s   &ff    r   Ú_readlinkErrorTestÚLockingTests._readlinkErrorTest9  sŒ   ù€ ÷	-ñ 	-ð 	�
‰
”8˜Z¨Ô6à—‘“ˆô 	×Òœ˜U› UÔ+ä×&Ò& uÓ-ˆØ×Ñ ¨t¯y©yÓ9ˆØ×Ñ˜Ÿ™ EÔ*Ø×Ñ˜Ÿ™Ö%r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   K  s   € ÷ 7ñ 7 Dñ 7r   c                ó–   € V P                  \        \        P                  4       V P                  \        \        P                  4       R# )zo
An exception raised by C{readlink} other than C{ENOENT} is passed up to
the caller of L{FilesystemLock.lock}.
N)rÛ   r   r    rƒ   r:   rX   s   &r   Útest_readlinkErrorÚLockingTests.test_readlinkErrorK  s,   € ð
 	×Ñ¤¬¯©Ô6Ø×Ñ¤¬¯©Ö6r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   W  s   € ÷ 	7ñ 	7¨ñ 	7r   c                ó–   € V P                  \        \        P                  4       V P                  \        \        P                  4       R# )zÒ
Any L{IOError} raised by C{readlink} on a POSIX platform passed to the
caller of L{FilesystemLock.lock}.

On POSIX, unlike on Windows, these are unexpected errors which cannot
be handled by L{FilesystemLock}.
N)rÛ   r:   r    rƒ   rL   rX   s   &r   Útest_readlinkErrorPOSIXÚ$LockingTests.test_readlinkErrorPOSIXS  s,   € ð 	×Ñ¤¬¯©Ô6Ø×Ñ¤¬¯©Ö6r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   b  s   € ÷ %ñ %°ñ %r   c                ó¼  aa€ R VV3R llpV P                  \        RV4      oR R lpV P                  \        RV4       V P                  4       o\        P                  ! S4      p\        P                  ! \        R4      S4       V P                  VP                  4       4       V P                  VP                  4       V P                  VP                  4       R# )	z·
If a second process cleans up the lock after a first one checks the
lock and finds that no process is holding it, the first process does
not fail when it tries to clean up the lock.
c               ó    € V ^8„  d   QhRRRR/# )r   r$   r.   r   r   r   )r   s   "r   r   ÚALockingTests.test_lockCleanedUpConcurrently.<locals>.__annotate__i  s   € ÷ 	)ñ 	)˜Sð 	) Tñ 	)r   c                ó|   <€ SP                  4        \        P                  ! S4       \        P                  ! V 4      # r2   )r´   r   r³   )r$   r~   ÚrmlinkPatchs   &€€r   Ú
fakeRmlinkÚ?LockingTests.test_lockCleanedUpConcurrently.<locals>.fakeRmlinki  s*   ø€ Ø×ÑÔ!ä�OŠO˜EÔ"ä—?’? 4Ó(Ð(r   r³   c               ó$   € V ^8„  d   QhRRRRRR/# r    r   )r   s   "r   r   rè   r  r¤   r   c                óŠ   € V^ 8w  d   \        \        P                  R4      hV R8X  d   \        \        P                  R4      hR# rº   r§   r¼   s   &&r   rª   Ú=LockingTests.test_lockCleanedUpConcurrently.<locals>.fakeKillr  r¾   r   rU   r»   Nr¿   )r#   rë   rª   rc   r~   rê   s   &   @@r   Útest_lockCleanedUpConcurrentlyÚ+LockingTests.test_lockCleanedUpConcurrentlyb  s™   ù€ ÷	)ñ 	)ð —j‘j¤¨8°ZÓ@ˆõ	1ð 	�
‰
”8˜V XÔ.à—‘“ˆÜ×&Ò& uÓ-ˆÜ×Òœ˜U› UÔ+Ø�‰˜Ÿ	™	›Ô$Ø�‰˜Ÿ
™
Ô#Ø�‰˜Ÿ™Ö$r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   �  s   € ÷ &ñ & $ñ &r   c                óÐ  € R R lpV P                  \        RV4       R R lpV P                  \        RV4       V P                  4       p\        P                  ! \	        R4      V4       \        P
                  ! V4      pV P                  \        VP                  4      pV P                  VP                  \        P                  4       V P                  VP                  4       R# )	zm
An exception raised by L{rmlink} other than C{ENOENT} is passed up
to the caller of L{FilesystemLock.lock}.
c               ó    € V ^8„  d   QhRRRR/# rÍ   r   )r   s   "r   r   Ú3LockingTests.test_rmlinkError.<locals>.__annotate__‡  s   € ÷ 	.ñ 	.˜Sð 	. Xñ 	.r   c                ó6   € \        \        P                  R 4      hr2   )r   r    rƒ   rÐ   s   &r   rë   Ú1LockingTests.test_rmlinkError.<locals>.fakeRmlink‡  rO   r   r³   c               ó$   € V ^8„  d   QhRRRRRR/# r    r   )r   s   "r   r   rõ   Œ  r¤   r   c                óŠ   € V^ 8w  d   \        \        P                  R4      hV R8X  d   \        \        P                  R4      hR# rº   r§   r¼   s   &&r   rª   Ú/LockingTests.test_rmlinkError.<locals>.fakeKillŒ  r¾   r   rU   r»   N)r9   r   r   r   r.   rb   r   r   rc   r   r    rƒ   rd   rŽ   )r#   rë   rª   r~   rc   r%   s   &     r   Útest_rmlinkErrorÚLockingTests.test_rmlinkError�  s¡   € õ	.ð 	�
‰
”8˜X zÔ2õ	1ð 	�
‰
”8˜V XÔ.à—‘“ˆô 	×Òœ˜U› UÔ+ä×&Ò& uÓ-ˆØ×Ñ¤¨¯©Ó3ˆØ×Ñ˜Ÿ™¤E§L¡LÔ1Ø×Ñ˜Ÿ™Ö%r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   ž  s   € ÷ &ñ & ñ &r   c                ó–  € R R lpV P                  \        RV4       V P                  4       p\        P                  ! \	        R4      V4       \        P
                  ! V4      pV P                  \        VP                  4      pV P                  VP                  \        P                  4       V P                  VP                  4       R# )z–
If L{kill} raises an exception other than L{OSError} with errno set to
C{ESRCH}, the exception is passed up to the caller of
L{FilesystemLock.lock}.
c               ó$   € V ^8„  d   QhRRRRRR/# )r   r¡   rt   r¢   r   r   r   )r   s   "r   r   Ú1LockingTests.test_killError.<locals>.__annotate__¥  s!   € ÷ 	-ñ 	-˜#ð 	- sð 	-¨xñ 	-r   c                ó6   € \        \        P                  R 4      hr2   )r   r    r¨   r¼   s   &&r   rª   Ú-LockingTests.test_killError.<locals>.fakeKill¥  s   € Üœ%Ÿ+™+ tÓ,Ð,r   rU   r»   N)r9   r   r   r   r.   rb   r   r   rc   r   r    r¨   rd   rŽ   )r#   rª   r~   rc   r%   s   &    r   Útest_killErrorÚLockingTests.test_killErrorž  sŠ   € õ	-ð 	�
‰
”8˜V XÔ.à—‘“ˆô 	×Òœ˜U› UÔ+ä×&Ò& uÓ-ˆØ×Ñ¤¨¯©Ó3ˆØ×Ñ˜Ÿ™¤E§K¡KÔ0Ø×Ñ˜Ÿ™Ö%r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   ´  s   € ÷ 3ñ 3 $ñ 3r   c                ó  € V P                  4       p\        P                  ! \        \        P
                  ! 4       ^,           4      V4       \        P                  ! V4      pV P                  \        VP                  4       R# )zj
L{FilesystemLock.unlock} raises L{ValueError} if called for a lock
which is held by a different process.
N)
r   r   r   r.   rV   rW   rb   r   Ú
ValueErrorr”   r�   s   &  r   Útest_unlockOtherÚLockingTests.test_unlockOther´  sR   € ð
 —‘“ˆÜ×ÒœœRŸYšY›[¨1�_Ó-¨uÔ5Ü×&Ò& uÓ-ˆØ×Ñœ* d§k¡kÖ2r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   ru   ¾  s   € ÷ 3ñ 3˜tñ 3r   c                óŽ  € V P                  4       pV P                  \        P                  ! V4      4       \        P                  ! V4      pV P                  VP                  4       4       V P                  \        P                  ! V4      4       VP                  4        V P                  \        P                  ! V4      4       R# )zX
L{isLocked} returns C{True} if the named lock is currently locked,
C{False} otherwise.
N)r   rd   r   ÚisLockedrb   rŒ   rc   r”   r�   s   &  r   Útest_isLockedÚLockingTests.test_isLocked¾  sƒ   € ð
 —‘“ˆØ×Ñœ×*Ò*¨5Ó1Ô2Ü×&Ò& uÓ-ˆØ�‰˜Ÿ	™	›Ô$Ø�‰œ×)Ò)¨%Ó0Ô1Ø�‰ŒØ×Ñœ×*Ò*¨5Ó1Ö2r   r   N)rh   ri   rj   rk   r   r„   r   r   rm   rˆ   r�   r•   r›   r¬   rÀ   r   rÈ   rÒ   rÛ   rß   rã   rð   rû   r  r  r  rp   r   r   r   rr   rr   …   sî   † õ	+õ-ñ Ø×ÒÓØCóô	*ó	ð	*õ	%õ%õ 
,õEõ2%ñ> Ø×ÒÓØOóô&ó	ð&ñ, Ø×ÒÓØTóô&ó	ð&õ*&õ$7ñ Ø×ÒÓØCóô	7ó	ð	7õ%õ>&õ:&õ,3÷3ñ 3r   rr   )rl   Ú
__future__r   r    rV   Úunittestr   r   Útypingr   Útwisted.pythonr   Útwisted.python.reflectr   Útwisted.python.runtimer   Útwisted.trial.unittestr	   rn   ro   rm   r   rr   r   r   r   Ú<module>r     sƒ   ðñ
õ #ã Û 	ß 'å å #Ý 0Ý +Ý +à€Ø€Ø×Ò×ÒáÐ,Ó-Ò5Ù˜,Ó'Ò/àˆð<ð 	ô_$�ô _$ôDD3�8ö D3r   