Rev 4708: Fix OSX and FreeBSD failures. in file:///net/bigmamac.local/Volumes/home/vila/src/bzr/bugs/tiger-regressions/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Sat Sep 19 17:14:14 BST 2009
At file:///net/bigmamac.local/Volumes/home/vila/src/bzr/bugs/tiger-regressions/
------------------------------------------------------------
revno: 4708
revision-id: v.ladeuil+lp at free.fr-20090919161410-lmlunl2q9kbzd3x0
parent: pqm at pqm.ubuntu.com-20090919013310-4lds9snxescbsxed
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: tiger-regressions
timestamp: Sat 2009-09-19 18:14:10 +0200
message:
Fix OSX and FreeBSD failures.
* bzrlib/tests/__init__.py:
(TestCaseWithMemoryTransport._make_test_root): Fixing the problem
at the root, if we usr the real path there, we catch 99% of the
consequences.
* bzrlib/tests/test_osutils.py:
(TestCanonicalRelPath.test_canonical_relpath_simple,
TestCanonicalRelPath.test_canonical_relpath_missing_tail): No need
to use realpath here anymore.
* bzrlib/tests/script.py:
(ScriptRunner.do_rm): OSX and BSD raises a different exception,
and windows too even if that will require real testing (but
osutils._delete_file_or_dir use the same trick for unlink so it's
a pretty safe bet).
* bzrlib/tests/blackbox/test_outside_wt.py:
(TestOutsideWT.test_cwd_log,
TestOutsideWT.test_diff_outside_tree): Watch for OSX trick.
-------------- next part --------------
=== 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