Rev 4658: (robertc) Improve behaviour of tests that have a reasonable excuse in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Aug 27 05:19:41 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4658 [merge]
revision-id: pqm at pqm.ubuntu.com-20090827041938-ledf747rl9hisefy
parent: pqm at pqm.ubuntu.com-20090827022719-bl2yoqhpj3fcfczu
parent: robertc at robertcollins.net-20090825233810-se5e9d9gdeehpy9v
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-08-27 05:19:38 +0100
message:
  (robertc) Improve behaviour of tests that have a reasonable excuse
  	for causing locking issues on windows selftest. (Robert Collins)
modified:
  bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
  bzrlib/tests/per_workingtree/test_flush.py test_flush.py-20061005073432-585uyj0sua6r7i9v-1
  bzrlib/tests/per_workingtree/test_locking.py test_locking.py-20060707151933-tav3o2hpibwi53u4-3
  bzrlib/tests/per_workingtree/test_set_root_id.py test_set_root_id.py-20061004073850-0r1c7qikmnkb8m9k-1
=== 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