Rev 4708: (vila) Fix some test regressions on OSX and FreeBSD in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sun Sep 20 00:07:20 BST 2009


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

------------------------------------------------------------
revno: 4708 [merge]
revision-id: pqm at pqm.ubuntu.com-20090919230718-vm9zqiov9h3t9bzg
parent: pqm at pqm.ubuntu.com-20090919013310-4lds9snxescbsxed
parent: v.ladeuil+lp at free.fr-20090919222248-zeqz8sjyd6fu965a
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sun 2009-09-20 00:07:18 +0100
message:
  (vila) Fix some test regressions on OSX and FreeBSD
modified:
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/blackbox/test_outside_wt.py test_outside_wt.py-20060116200058-98edd33e7db8bdde
  bzrlib/tests/script.py         script.py-20090901081155-yk3tiy1nunxg16ne-1
  bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-09-18 08:55:12 +0000
+++ b/bzrlib/tests/__init__.py	2009-09-19 16:14:10 +0000
@@ -2346,7 +2346,9 @@
 
     def _make_test_root(self):
         if TestCaseWithMemoryTransport.TEST_ROOT is None:
-            root = osutils.mkdtemp(prefix='testbzr-', suffix='.tmp')
+            # Watch out for tricky test dir (on OSX /tmp -> /private/tmp)
+            root = osutils.realpath(osutils.mkdtemp(prefix='testbzr-',
+                                                    suffix='.tmp'))
             TestCaseWithMemoryTransport.TEST_ROOT = root
 
             self._create_safety_net()

=== modified file 'bzrlib/tests/blackbox/test_outside_wt.py'
--- a/bzrlib/tests/blackbox/test_outside_wt.py	2009-09-17 11:54:41 +0000
+++ b/bzrlib/tests/blackbox/test_outside_wt.py	2009-09-19 16:14:10 +0000
@@ -32,7 +32,8 @@
     """Test that bzr gives proper errors outside of a working tree."""
 
     def test_cwd_log(self):
-        tmp_dir = osutils.mkdtemp()
+        # Watch out for tricky test dir (on OSX /tmp -> /private/tmp)
+        tmp_dir = osutils.realpath(osutils.mkdtemp())
         # We expect a read-to-root attempt to occur.
         self.permit_url('file:///')
         self.addCleanup(lambda: osutils.rmtree(tmp_dir))
@@ -54,7 +55,8 @@
         # A directory we can run commands from which we hope is not contained
         # in a bzr tree (though if there is one at or above $TEMPDIR, this is
         # false and may cause test failures).
-        tmp_dir = osutils.mkdtemp()
+        # Watch out for tricky test dir (on OSX /tmp -> /private/tmp)
+        tmp_dir = osutils.realpath(osutils.mkdtemp())
         self.addCleanup(lambda: osutils.rmtree(tmp_dir))
         # We expect a read-to-root attempt to occur.
         self.permit_url('file:///')

=== modified file 'bzrlib/tests/script.py'
--- a/bzrlib/tests/script.py	2009-09-18 08:48:23 +0000
+++ b/bzrlib/tests/script.py	2009-09-19 16:14:10 +0000
@@ -349,7 +349,9 @@
             try:
                 os.remove(p)
             except OSError, e:
-                if e.errno == errno.EISDIR:
+                # Various OSes raises different exceptions (linux: EISDIR,
+                #   win32: EACCES, OSX: EPERM) when invoked on a directory
+                if e.errno in (errno.EISDIR, errno.EPERM, errno.EACCES):
                     if recursive:
                         osutils.rmtree(p)
                     else:

=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py	2009-09-17 06:49:43 +0000
+++ b/bzrlib/tests/test_osutils.py	2009-09-19 16:14:10 +0000
@@ -447,16 +447,12 @@
     def test_canonical_relpath_simple(self):
         f = file('MixedCaseName', 'w')
         f.close()
-        # Watch out for tricky test dir (on OSX /tmp -> /private/tmp)
-        real_base_dir = osutils.realpath(self.test_base_dir)
-        actual = osutils.canonical_relpath(real_base_dir, 'mixedcasename')
+        actual = osutils.canonical_relpath(self.test_base_dir, 'mixedcasename')
         self.failUnlessEqual('work/MixedCaseName', actual)
 
     def test_canonical_relpath_missing_tail(self):
         os.mkdir('MixedCaseParent')
-        # Watch out for tricky test dir (on OSX /tmp -> /private/tmp)
-        real_base_dir = osutils.realpath(self.test_base_dir)
-        actual = osutils.canonical_relpath(real_base_dir,
+        actual = osutils.canonical_relpath(self.test_base_dir,
                                            'mixedcaseparent/nochild')
         self.failUnlessEqual('work/MixedCaseParent/nochild', actual)
 




More information about the bazaar-commits mailing list