403Webshell
Server IP : 61.19.30.66  /  Your IP : 216.73.216.15
Web Server : Apache/2.2.22 (Ubuntu)
System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64
User : www-data ( 33)
PHP Version : 5.3.10-1ubuntu3.48
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python2.7/dist-packages/twisted/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyc
ó
[³XMc@sÓdZddlZddlZddlmZddlmZddlmZdZ
ejƒry ddlm
Z
ddlZWqek
r™dZ
qXndejfd	„ƒYZd
ejfd„ƒYZdS(s'
Tests for L{twisted.python.lockfile}.
iÿÿÿÿN(tunittest(tlockfile(tplatform(tOpenProcesssZOn windows, lockfile.kill is not implemented in the absence of win32api and/or pywintypes.t	UtilTestscBseZdZd„Zd„Zejƒs6de_nd„Zd„Z	ejƒs`de	_nd„Z
ee
_d„Zee_d	„Z
RS(
sM
    Tests for the helper functions used to implement L{FilesystemLock}.
    cCsQ|jƒ}tjd|ƒ|jttjd|ƒ}|j|jtjƒdS(s 
        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.
        tfooN(tmktempRtsymlinktassertRaisestOSErrortassertEqualterrnotEEXIST(tselftnametexc((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_symlinkEEXISTscCs]|jƒ}d„}|jtd|ƒ|jttj|dƒ}|j|jtjƒdS(s<
        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).
        cSsttjdƒ‚dS(N(tIOErrorRtEIOtNone(tsrctdst((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyt
fakeRename1strenameRN(	RtpatchRRRRR
RR(R
RRR((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_symlinkEIOWindows's
		sBspecial rename EIO handling only necessary and correct on Windows.cCs>|jƒ}|jttj|ƒ}|j|jtjƒdS(sŸ
        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(RRR	RtreadlinkR
RtENOENT(R
RR((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_readlinkENOENT<scCsZ|jƒ}d„}|jtd|ƒ|jttj|ƒ}|j|jtjƒdS(s\
        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).
        cSsttjdƒ‚dS(N(RRtEACCESR(tpathtmode((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pytfakeOpenPst_openN(	RRRRRRR
RR(R
RR R((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_readlinkEACCESWindowsFs
		sGspecial readlink EACCES handling only necessary and correct on Windows.cCstjtjƒdƒdS(s}
        L{lockfile.kill} returns without error if passed the PID of a
        process which exists and signal C{0}.
        iN(Rtkilltostgetpid(R
((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyt	test_kill[scCs5|jttjddƒ}|j|jtjƒdS(s
        L{lockfile.kill} raises L{OSError} with errno of L{ESRCH} if
        passed a PID which does not correspond to any process.
        iiiiNI€iÿÿÿ(RR	RR#R
RtESRCH(R
R((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_killESRCHdscCsI|jtddƒtj|jƒƒ}|jƒ|j|jƒƒdS(sµ
        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}.
        R#N(RRRtFilesystemLockRtlocktassertFalse(R
tfl((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_noKillCallos
(t__name__t
__module__t__doc__RRRt	isWindowstskipRR"R&tskipKillR(R-(((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyRs			
					tLockingTestCasecBs
eZd„Zd„Zd„Zejƒr9de_nd„Zd„Z	d„Z
d„Zd„Zd	„Z
ejƒs‡d
e
_nd„Zejƒs¨de_nd
„Zd„Zd„ZejƒrÛde_nd„Zd„Zd„Zd„Zd„ZRS(csi‡fd†}|jtd|ƒ|jƒ}tj|ƒ}|jt|jƒ}|j|jˆƒdS(Ncstˆdƒ‚dS(N(R	R(tsourcetdest(R(s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pytfakeSymlink~sR(	RRRR)RR	R*R
R(R
RR7tlockfR*R((Rs>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyt_symlinkErrorTest}scCs|jtjƒdS(s†
        An exception raised by C{symlink} other than C{EEXIST} is passed up to
        the caller of L{FilesystemLock.lock}.
        N(R9RtENOSYS(R
((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_symlinkErrorˆscCs$|jtjƒ|jtjƒdS(s 
        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(R9RRR(R
((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_symlinkErrorPOSIXss9POSIX-specific error propagation not expected on Windows.cCsR|jƒ}tj|ƒ}|j|jƒƒ|j|jƒ|j|jƒdS(s‹
        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(RRR)t
assertTrueR*tcleantlocked(R
R8R*((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_cleanlyAcquireŸs
cCsŽ|jƒ}tj|ƒ}|j|jƒƒ|jƒ|j|jƒtj|ƒ}|j|jƒƒ|j|jƒ|j|jƒdS(sŒ
        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(	RRR)R=R*tunlockR+R?R>(R
R8R*((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_cleanlyRelease«s
cCsd|jƒ}tj|ƒ}|j|jƒƒtj|ƒ}|j|jƒƒ|j|jƒdS(sK
        If a lock is currently locked, it cannot be locked again.
        N(RRR)R=R*R+R?(R
R8t	firstLockt
secondLock((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_cannotLockLocked¼scsµd‰‡fd†}|jƒ}|jtd|ƒtjtˆƒ|ƒtj|ƒ}|j|jƒƒ|j|j	ƒ|j|j
ƒ|jtj|ƒtt
jƒƒƒdS(sÇ
        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}.
        i90csF|dkr!ttjdƒ‚n|ˆkrBttjdƒ‚ndS(Ni(R	RtEPERMRR'(tpidtsignal(towner(s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pytfakeKillÑsR#N(RRRRtstrR)R=R*R+R>R?R
RR$R%(R
RJR8R*((RIs>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_uncleanlyAcquireÉscs«‡‡fd†}|jtd|ƒ‰d„}|jtd|ƒ|jƒ‰tjˆƒ}tjtdƒˆƒ|j|jƒƒ|j|jƒ|j|j	ƒdS(sð
        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}.
        cs$tjˆƒˆjƒtj|ƒS(N(RtrmlinktrestoreR(R(R8t
readlinkPatch(s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pytfakeReadlinkés

RcSsF|dkr!ttjdƒ‚n|dkrBttjdƒ‚ndS(Niiu¨(R	RRFRR'(RGRH((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyRJñsR#iu¨N(
RRRR)RRKR=R*R>R?(R
RPRJR*((R8ROs>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_lockReleasedBeforeCheckãs	cCs^d„}|jtd|ƒ|jƒ}tj|ƒ}|j|jƒƒ|j|jƒdS(s“
        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.
        cSsttjdƒ‚dS(N(R	RRR(RR((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyR7	sRN(RRRR)R+R*R?(R
R7R8R*((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyt%test_lockReleasedDuringAcquireSymlinks		sBspecial rename EIO handling only necessary and correct on Windows.cCsvd„}|jtd|ƒ}|jƒ}tj|ƒ}tjtdƒ|ƒ|j|jƒƒ|j|jƒdS(s»
        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}.
        cSsttjdƒ‚dS(N(RRRR(R((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyRP sRiu¨N(	RRRR)RRKR+R*R?(R
RPROR8R*((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyt&test_lockReleasedDuringAcquireReadlinks	sGspecial readlink EACCES handling only necessary and correct on Windows.cs’‡‡fd†}|jtd|ƒ|jƒ}tjtdƒ|ƒtj|ƒ}|jˆ|jƒ}|j|j	ˆƒ|j
|jƒdS(Ncsˆˆdƒ‚dS(N(R(R(Rt
exceptionType(s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyRP3sRiu¨(RRRRRKR)RR*R
RR+R?(R
RTRRPR8R*R((RRTs>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyt_readlinkErrorTest2scCs*|jttjƒ|jttjƒdS(s‡
        An exception raised by C{readlink} other than C{ENOENT} is passed up to
        the caller of L{FilesystemLock.lock}.
        N(RUR	RR:R(R
((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_readlinkErrorBscCs*|jttjƒ|jttjƒdS(sú
        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(RURRR:R(R
((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_readlinkErrorPOSIXKscs«‡‡fd†}|jtd|ƒ‰d„}|jtd|ƒ|jƒ‰tjˆƒ}tjtdƒˆƒ|j|jƒƒ|j|jƒ|j|j	ƒdS(s×
        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.
        cs$ˆjƒtjˆƒtj|ƒS(N(RNRRM(R(trmlinkPatchR8(s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyt
fakeRmlink`s

RMcSsF|dkr!ttjdƒ‚n|dkrBttjdƒ‚ndS(Niiu¨(R	RRFRR'(RGRH((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyRJhsR#iu¨N(
RRRR)RRKR=R*R>R?(R
RYRJR*((R8RXs>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_lockCleanedUpConcurrentlyZs	cCs¨d„}|jtd|ƒd„}|jtd|ƒ|jƒ}tjtdƒ|ƒtj|ƒ}|jt|jƒ}|j	|j
t
jƒ|j|j
ƒdS(s…
        An exception raised by L{rmlink} other than C{ENOENT} is passed up
        to the caller of L{FilesystemLock.lock}.
        cSsttjdƒ‚dS(N(R	RR:R(R((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyRY|sRMcSsF|dkr!ttjdƒ‚n|dkrBttjdƒ‚ndS(Niiu¨(R	RRFRR'(RGRH((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyRJ€sR#iu¨N(RRRRRKR)RR	R*R
RR:R+R?(R
RYRJR8R*R((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_rmlinkErrorws		cCsŒd„}|jtd|ƒ|jƒ}tjtdƒ|ƒtj|ƒ}|jt|jƒ}|j	|j
t
jƒ|j|j
ƒdS(s¶
        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}.
        cSsttjdƒ‚dS(N(R	RRFR(RGRH((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyRJ˜sR#iu¨N(RRRRRKR)RR	R*R
RRFR+R?(R
RJR8R*R((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_killError’s	cCsR|jƒ}tjttjƒdƒ|ƒtj|ƒ}|jt|j	ƒdS(s‚
        L{FilesystemLock.unlock} raises L{ValueError} if called for a lock
        which is held by a different process.
        iN(
RRRRKR$R%R)Rt
ValueErrorRA(R
R8R*((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyttest_unlockOther§s cCs~|jƒ}|jtj|ƒƒtj|ƒ}|j|jƒƒ|jtj|ƒƒ|jƒ|jtj|ƒƒdS(sp
        L{isLocked} returns C{True} if the named lock is currently locked,
        C{False} otherwise.
        N(RR+RtisLockedR)R=R*RA(R
R8R*((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyt
test_isLocked²s
(R.R/R9R;R<RR1R2R@RBRERLRQRRRSRURVRWRZR[R\R^R`(((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyR4|s4			
			
								
				(R0R$Rt
twisted.trialRttwisted.pythonRttwisted.python.runtimeRRR3R1twin32apiRt
pywintypestImportErrortTestCaseRR4(((s>/usr/lib/python2.7/dist-packages/twisted/test/test_lockfile.pyt<module>s

d

Youez - 2016 - github.com/yon3zu
LinuXploit