Rev 3026: Handle repositories that do not physically lock in workingtree_implementation tests. in http://people.ubuntu.com/~robertc/baz2.0/pack.read-locks

Robert Collins robertc at robertcollins.net
Mon Nov 26 03:12:03 GMT 2007


At http://people.ubuntu.com/~robertc/baz2.0/pack.read-locks

------------------------------------------------------------
revno: 3026
revision-id:robertc at robertcollins.net-20071126031158-0jhxvgtik27maw29
parent: robertc at robertcollins.net-20071126023626-g5by92lh6cakhkpq
committer: Robert Collins <robertc at robertcollins.net>
branch nick: pack.read-locks
timestamp: Mon 2007-11-26 14:11:58 +1100
message:
  Handle repositories that do not physically lock in workingtree_implementation tests.
modified:
  bzrlib/tests/workingtree_implementations/test_break_lock.py test_break_lock.py-20060504115740-233e245df546fd42
=== modified file 'bzrlib/tests/workingtree_implementations/test_break_lock.py'
--- a/bzrlib/tests/workingtree_implementations/test_break_lock.py	2007-02-26 01:06:36 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_break_lock.py	2007-11-26 03:11:58 +0000
@@ -20,6 +20,7 @@
 
 import bzrlib
 import bzrlib.errors as errors
+from bzrlib.tests import TestNotApplicable
 from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
 
 
@@ -51,14 +52,19 @@
         # if the workingtree isn't locked - and the easiest way
         # to see if that happened is to lock the repo.
         self.workingtree.branch.repository.lock_write()
-        bzrlib.ui.ui_factory.stdin = StringIO("y\n")
+        stdin = StringIO("y\n")
+        bzrlib.ui.ui_factory.stdin = stdin
         try:
             self.unused_workingtree.break_lock()
         except NotImplementedError:
             # workingtree does not support break_lock
             self.workingtree.branch.repository.unlock()
             return
-        self.assertRaises(errors.LockBroken, self.workingtree.branch.repository.unlock)
+        remaining = stdin.read()
+        if remaining == 'y\n':
+            raise TestNotApplicable("repository does not physically lock.")
+        self.assertRaises(errors.LockBroken,
+            self.workingtree.branch.repository.unlock)
 
     def test_locked(self):
         # break_lock when locked should



More information about the bazaar-commits mailing list