Rev 4651: Improve behaviour of tests that have a reasonable excuse for causing locking issues on windows selftest. in http://bazaar.launchpad.net/~lifeless/bzr/shelve-locks
Robert Collins
robertc at robertcollins.net
Wed Aug 26 00:38:16 BST 2009
At http://bazaar.launchpad.net/~lifeless/bzr/shelve-locks
------------------------------------------------------------
revno: 4651
revision-id: robertc at robertcollins.net-20090825233810-se5e9d9gdeehpy9v
parent: robertc at robertcollins.net-20090825210917-dq2i8k6n4z63pneh
committer: Robert Collins <robertc at robertcollins.net>
branch nick: shelve-locks
timestamp: Wed 2009-08-26 09:38:10 +1000
message:
Improve behaviour of tests that have a reasonable excuse for causing locking issues on windows selftest.
=== modified file 'bzrlib/tests/blackbox/test_info.py'
--- a/bzrlib/tests/blackbox/test_info.py 2009-08-17 03:47:03 +0000
+++ b/bzrlib/tests/blackbox/test_info.py 2009-08-25 23:38:10 +0000
@@ -1328,6 +1328,10 @@
def test_info_locking_oslocks(self):
if sys.platform == "win32":
raise TestSkipped("don't use oslocks on win32 in unix manner")
+ # This test tests old (all-in-one, OS lock using) behaviour which
+ # simply cannot work on windows (and is indeed why we changed our
+ # design. As such, don't try to remove the thisFailsStrictLockCheck
+ # call here.
self.thisFailsStrictLockCheck()
tree = self.make_branch_and_tree('branch',
=== modified file 'bzrlib/tests/per_workingtree/test_flush.py'
--- a/bzrlib/tests/per_workingtree/test_flush.py 2009-07-31 17:42:29 +0000
+++ b/bzrlib/tests/per_workingtree/test_flush.py 2009-08-25 23:38:10 +0000
@@ -16,7 +16,9 @@
"""Tests for WorkingTree.flush."""
+import sys
from bzrlib import errors, inventory
+from bzrlib.tests import TestSkipped
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
@@ -31,8 +33,14 @@
tree.unlock()
def test_flush_when_inventory_is_modified(self):
+ if sys.platform == "win32":
+ raise TestSkipped("don't use oslocks on win32 in unix manner")
# This takes a write lock on the source tree, then opens a second copy
- # and tries to grab a read lock, which is a bit bogus
+ # and tries to grab a read lock. This works on Unix and is a reasonable
+ # way to detect when the file is actually written to, but it won't work
+ # (as a test) on Windows. It might be nice to instead stub out the
+ # functions used to write and that way do both less work and also be
+ # able to execute on Windows.
self.thisFailsStrictLockCheck()
# when doing a flush the inventory should be written if needed.
# we test that by changing the inventory (using
=== modified file 'bzrlib/tests/per_workingtree/test_locking.py'
--- a/bzrlib/tests/per_workingtree/test_locking.py 2009-07-31 17:42:29 +0000
+++ b/bzrlib/tests/per_workingtree/test_locking.py 2009-08-25 23:38:10 +0000
@@ -16,11 +16,14 @@
"""Tests for the (un)lock interfaces on all working tree implemenations."""
+import sys
+
from bzrlib import (
branch,
errors,
lockdir,
)
+from bzrlib.tests import TestSkipped
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
@@ -105,8 +108,14 @@
:param methodname: The lock method to use to establish locks.
"""
- # This write locks the local tree, and then grabs a read lock on a
- # copy, which is bogus and the test just needs to be rewritten.
+ if sys.platform == "win32":
+ raise TestSkipped("don't use oslocks on win32 in unix manner")
+ # This helper takes a write lock on the source tree, then opens a
+ # second copy and tries to grab a read lock. This works on Unix and is
+ # a reasonable way to detect when the file is actually written to, but
+ # it won't work (as a test) on Windows. It might be nice to instead
+ # stub out the functions used to write and that way do both less work
+ # and also be able to execute on Windows.
self.thisFailsStrictLockCheck()
# when unlocking the last lock count from tree_write_lock,
# the tree should do a flush().
=== modified file 'bzrlib/tests/per_workingtree/test_set_root_id.py'
--- a/bzrlib/tests/per_workingtree/test_set_root_id.py 2009-08-21 01:48:13 +0000
+++ b/bzrlib/tests/per_workingtree/test_set_root_id.py 2009-08-25 23:38:10 +0000
@@ -16,13 +16,18 @@
"""Tests for WorkingTree.set_root_id"""
+import sys
+
from bzrlib import inventory
+from bzrlib.tests import TestSkipped
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
class TestSetRootId(TestCaseWithWorkingTree):
def test_set_and_read_unicode(self):
+ if sys.platform == "win32":
+ raise TestSkipped("don't use oslocks on win32 in unix manner")
# This test tests that setting the root doesn't flush, so it
# deliberately tests concurrent access that isn't possible on windows.
self.thisFailsStrictLockCheck()
More information about the bazaar-commits
mailing list