Rev 4339: Fixed as per Robert's review. in file:///home/vila/src/bzr/experimental/failing-lock-tests/

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue May 12 09:07:37 BST 2009


At file:///home/vila/src/bzr/experimental/failing-lock-tests/

------------------------------------------------------------
revno: 4339
revision-id: v.ladeuil+lp at free.fr-20090512080737-itf02crgp0kxir0p
parent: v.ladeuil+lp at free.fr-20090511103757-x030vepytcneozqa
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: failing-lock-tests
timestamp: Tue 2009-05-12 10:07:37 +0200
message:
  Fixed as per Robert's review.
  
  * tests/__init__.py:
  (TestCase._track_locks): Make unbalanced locks fatal.
  
  * tests/test_selftest.py:
  (TestTestCaseWithMemoryTransport.test_dangling_locks_cause_failures):
  The failure is now unconditional.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2009-05-08 15:39:11 +0000
+++ b/NEWS	2009-05-12 08:07:37 +0000
@@ -117,6 +117,12 @@
 
 * Updated the bundled ``ConfigObj`` library to 4.6.0 (Matt Nordhoff)
 
+Testing
+*******
+
+* ``bzr selftest`` will now fail if lock/unlock are not correctly balanced in
+  tests. Using ``-Dlock`` will turn the related failures into warnings.
+  (Vincent Ladeuil, Robert Collins)
 
 bzr 1.14
 ###########

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-05-08 15:58:00 +0000
+++ b/bzrlib/tests/__init__.py	2009-05-12 08:07:37 +0000
@@ -884,7 +884,7 @@
     def _track_locks(self):
         """Track lock activity during tests."""
         self._lock_actions = []
-        self._lock_check_thorough = 'lock' in debug.debug_flags
+        self._lock_check_thorough = 'lock' not in debug.debug_flags
         self.addCleanup(self._check_locks)
         _mod_lock.Lock.hooks.install_named_hook('lock_acquired',
                                                 self._lock_acquired, None)

=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py	2009-04-30 06:16:30 +0000
+++ b/bzrlib/tests/test_selftest.py	2009-05-12 08:07:37 +0000
@@ -622,9 +622,6 @@
         self.assertRaises(AssertionError, self._check_safety_net)
 
     def test_dangling_locks_cause_failures(self):
-        # This is currently only enabled during debug runs, so turn debugging
-        # on.
-        debug.debug_flags.add('lock')
         class TestDanglingLock(TestCaseWithMemoryTransport):
             def test_function(self):
                 t = self.get_transport('.')



More information about the bazaar-commits mailing list