Rev 2355: Add a tests that multiple write locks raise the right kind of error. in http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/locking

John Arbash Meinel john at arbash-meinel.com
Tue Mar 13 19:16:05 GMT 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/locking

------------------------------------------------------------
revno: 2355
revision-id: john at arbash-meinel.com-20070313191557-ouvms9hsnpij9xct
parent: john at arbash-meinel.com-20070313191105-dlkexxbr3jvva1rx
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: locking
timestamp: Tue 2007-03-13 13:15:57 -0600
message:
  Add a tests that multiple write locks raise the right kind of error.
modified:
  bzrlib/tests/test_lock.py      test_lock.py-20070313190612-mfpoa7t8kvrgrhj2-1
-------------- next part --------------
=== modified file 'bzrlib/tests/test_lock.py'
--- a/bzrlib/tests/test_lock.py	2007-03-13 19:11:05 +0000
+++ b/bzrlib/tests/test_lock.py	2007-03-13 19:15:57 +0000
@@ -17,6 +17,7 @@
 """Tests for OS level locks."""
 
 from bzrlib import (
+    errors,
     lock,
     tests,
     )
@@ -73,3 +74,9 @@
         b_lock = lock.ReadLock('a-file')
         self.addCleanup(b_lock.unlock)
 
+    def test_multiple_write_locks_exclude(self):
+        """Taking out more than one write lock should fail."""
+        a_lock = lock.WriteLock('a-file')
+        self.addCleanup(a_lock.unlock)
+        # Taking out a lock on a locked file should raise LockContention
+        self.assertRaises(errors.LockContention, lock.WriteLock, 'a-file')



More information about the bazaar-commits mailing list