Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/twisted_8_1/twisted/test/test_lockfile.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2005 Divmod, Inc.
2 # See LICENSE for details.
3
4 from twisted.trial import unittest
5 from twisted.python import lockfile
6
7 class LockingTestCase(unittest.TestCase):
8 def testBasics(self):
9 lockf = self.mktemp()
10 lock = lockfile.FilesystemLock(lockf)
11 self.failUnless(lock.lock())
12 self.failUnless(lock.clean)
13 lock.unlock()
14 self.failUnless(lock.lock())
15 self.failUnless(lock.clean)
16 lock.unlock()
17
18
19 def testProtection(self):
20 lockf = self.mktemp()
21 lock = lockfile.FilesystemLock(lockf)
22 self.failUnless(lock.lock())
23 self.failUnless(lock.clean)
24 self.failIf(lock.lock())
25 lock.unlock()
26
27
28 def testBigLoop(self):
29 lockf = self.mktemp()
30 lock = lockfile.FilesystemLock(lockf)
31 self.failUnless(lock.lock())
32 for i in xrange(500):
33 self.failIf(lock.lock())
34 lock.unlock()
35
36
37 def testIsLocked(self):
38 lockf = self.mktemp()
39 self.failIf(lockfile.isLocked(lockf))
40 lock = lockfile.FilesystemLock(lockf)
41 self.failUnless(lock.lock())
42 self.failUnless(lockfile.isLocked(lockf))
43 lock.unlock()
44 self.failIf(lockfile.isLocked(lockf))
45
46 # A multiprocess test would be good here, for the sake of
47 # completeness. However, it is fairly safe to rely on the
48 # filesystem to provide the semantics we require.
49
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/test/test_journal.py ('k') | third_party/twisted_8_1/twisted/test/test_log.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698