Rev 3334: Reduce some test code duplication for lockdir. in http://people.ubuntu.com/~robertc/baz2.0/physicallock.hooks
Robert Collins
robertc at robertcollins.net
Mon Apr 7 21:55:39 BST 2008
At http://people.ubuntu.com/~robertc/baz2.0/physicallock.hooks
------------------------------------------------------------
revno: 3334
revision-id: robertc at robertcollins.net-20080407205527-v85go5c4dc8cwe04
parent: robertc at robertcollins.net-20080404035337-ldligjwfp2bzqi47
committer: Robert Collins <robertc at robertcollins.net>
branch nick: PhysicalLock.hooks
timestamp: Tue 2008-04-08 06:55:27 +1000
message:
Reduce some test code duplication for lockdir.
modified:
bzrlib/lock.py lock.py-20050527050856-ec090bb51bc03349
bzrlib/tests/test_lockdir.py test_lockdir.py-20060220222025-33d4221569a3d600
=== modified file 'bzrlib/lock.py'
--- a/bzrlib/lock.py 2008-04-04 03:53:37 +0000
+++ b/bzrlib/lock.py 2008-04-07 20:55:27 +0000
@@ -68,6 +68,7 @@
class LockResult(object):
+ """The standard parameter given to PhysicalLock hook calls."""
def __init__(self, lock_url, details=None):
"""Create a lock result for lock with optional details about the lock."""
=== modified file 'bzrlib/tests/test_lockdir.py'
--- a/bzrlib/tests/test_lockdir.py 2008-04-04 03:53:37 +0000
+++ b/bzrlib/tests/test_lockdir.py 2008-04-07 20:55:27 +0000
@@ -654,13 +654,13 @@
self._old_hooks = lock.hooks
self.addCleanup(self.restore_hooks)
lock.hooks = lock.PhysicalLockHooks()
+ self._calls = []
def restore_hooks(self):
lock.hooks = self._old_hooks
def test_PhysicalLock_dot_acquired_success(self):
# the PhysicalLock.acquired hook fires when a lock is acquired.
- self._calls = []
self.reset_hooks()
lock.hooks.install_hook('acquired', self.record_hook)
ld = self.get_lock()
@@ -674,7 +674,6 @@
def test_PhysicalLock_dot_acquired_fail(self):
# the PhysicalLock.acquired hook does not fire on failure.
- self._calls = []
self.reset_hooks()
ld = self.get_lock()
ld.create()
@@ -689,7 +688,6 @@
def test_PhysicalLock_dot_released_success(self):
# the PhysicalLock.released hook fires when a lock is acquired.
- self._calls = []
self.reset_hooks()
lock.hooks.install_hook('released', self.record_hook)
ld = self.get_lock()
@@ -703,7 +701,6 @@
def test_PhysicalLock_dot_released_fail(self):
# the PhysicalLock.released hook does not fire on failure.
- self._calls = []
self.reset_hooks()
ld = self.get_lock()
ld.create()
More information about the bazaar-commits
mailing list