Rev 4534: Update the tests, adding a test for -Edisable_lock_checks. in lp:///~jameinel/bzr/1.18-lock-warnings
John Arbash Meinel
john at arbash-meinel.com
Fri Jul 31 17:08:33 BST 2009
At lp:///~jameinel/bzr/1.18-lock-warnings
------------------------------------------------------------
revno: 4534
revision-id: john at arbash-meinel.com-20090731160627-66v64hqnoxzkgi2v
parent: john at arbash-meinel.com-20090731155252-0r61x61q1ct6iv0f
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.18-lock-warnings
timestamp: Fri 2009-07-31 11:06:27 -0500
message:
Update the tests, adding a test for -Edisable_lock_checks.
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2009-07-31 15:52:52 +0000
+++ b/bzrlib/tests/__init__.py 2009-07-31 16:06:27 +0000
@@ -1312,6 +1312,16 @@
"""Make the logfile not be deleted when _finishLogFile is called."""
self._keep_log_file = True
+ def failsStrictLockCheck(self):
+ """It is known that this test would fail with -Dstrict_locks.
+
+ By default, all tests are run with strict lock checking unless
+ -Edisable_lock_checks is supplied. However there are some tests which
+ we know fail strict locks at this point that have not been fixed.
+ They should call this function to disable the strict checking.
+ """
+ debug.debug_flags.discard('strict_locks')
+
def addCleanup(self, callable, *args, **kwargs):
"""Arrange to run a callable when this case is torn down.
=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py 2009-07-22 06:00:45 +0000
+++ b/bzrlib/tests/test_selftest.py 2009-07-31 16:06:27 +0000
@@ -1350,6 +1350,7 @@
class _TestException(Exception):
pass
+
class TestTestCase(tests.TestCase):
"""Tests that test the core bzrlib TestCase."""
@@ -1427,6 +1428,24 @@
test.run(self.make_test_result())
self.assertEqual(set(['a-flag']), self.flags)
+ def test_disable_lock_checks(self):
+ """The -Edisable_lock_checks flag disables thorough checks."""
+ class TestThatRecordsFlags(tests.TestCase):
+ def test_foo(nested_self):
+ self.flags = set(bzrlib.debug.debug_flags)
+ self.test_lock_check_thorough = nested_self._lock_check_thorough
+ test = TestThatRecordsFlags('test_foo')
+ test.run(self.make_test_result())
+ self.assertTrue(self.test_lock_check_thorough)
+ self.assertEqual(set(), self.flags)
+ # Now set the disable_lock_checks flag, and assert that this is
+ # no longer true
+ self.change_selftest_debug_flags(set(['disable_lock_checks']))
+ test = TestThatRecordsFlags('test_foo')
+ test.run(self.make_test_result())
+ self.assertFalse(self.test_lock_check_thorough)
+ self.assertEqual(set(), self.flags)
+
def test_debug_flags_restored(self):
"""The bzrlib debug flags should be restored to their original state
after the test was run, even if allow_debug is set.
More information about the bazaar-commits
mailing list