Rev 2196: Branch implementations test test_set_get_parent should not depend on local urls : the test can be valid for any url namespace. Change it to be valid in that manner. (Robert Collins, Andrew Bennetts) in http://bazaar.launchpad.net/~bzr/bzr/hpss

Robert Collins robertc at robertcollins.net
Thu Mar 29 08:25:22 BST 2007


At http://bazaar.launchpad.net/~bzr/bzr/hpss

------------------------------------------------------------
revno: 2196
revision-id: robertc at robertcollins.net-20070329072414-7dh0io231c2tormb
parent: robertc at robertcollins.net-20070329065545-e4d0sbkszqbr5p84
committer: Robert Collins <robertc at robertcollins.net>
branch nick: hpss
timestamp: Thu 2007-03-29 17:24:14 +1000
message:
  Branch implementations test test_set_get_parent should not depend on local urls : the test can be valid for any url namespace. Change it to be valid in that manner. (Robert Collins, Andrew Bennetts)
modified:
  bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
  bzrlib/tests/branch_implementations/test_parent.py test_parent.py-20050830052751-5e62766623c32222
=== modified file 'bzrlib/tests/branch_implementations/test_branch.py'
--- a/bzrlib/tests/branch_implementations/test_branch.py	2007-03-29 05:00:40 +0000
+++ b/bzrlib/tests/branch_implementations/test_branch.py	2007-03-29 07:24:14 +0000
@@ -26,6 +26,7 @@
     gpg,
     urlutils,
     transactions,
+    remote,
     repository,
     )
 from bzrlib.branch import Branch, needs_read_lock, needs_write_lock
@@ -367,14 +368,9 @@
         # config file in the branch.
         branch.nick = "Aaron's branch"
         branch.nick = "Aaron's branch"
-        try:
+        if not isinstance(branch, remote.RemoteBranch):
             controlfilename = branch.control_files.controlfilename
-        except AttributeError:
-            # remote branches don't have control_files
-            pass
-        else:
-            self.failUnless(
-                t.has(t.relpath(controlfilename("branch.conf"))))
+            self.failUnless(t.has(t.relpath(controlfilename("branch.conf"))))
         # Because the nick has been set explicitly, the nick is now always
         # "Aaron's branch", regardless of directory name.
         self.assertEqual(branch.nick, "Aaron's branch")

=== modified file 'bzrlib/tests/branch_implementations/test_parent.py'
--- a/bzrlib/tests/branch_implementations/test_parent.py	2007-01-16 14:26:41 +0000
+++ b/bzrlib/tests/branch_implementations/test_parent.py	2007-03-29 07:24:14 +0000
@@ -19,6 +19,7 @@
 import os
 import sys
 
+from bzrlib import urlutils
 from bzrlib.branch import Branch
 import bzrlib.errors
 from bzrlib.osutils import abspath, realpath, getcwd
@@ -38,7 +39,7 @@
         
     def test_set_get_parent(self):
         """Set, re-get and reset the parent"""
-        b = self.make_branch('.')
+        b = self.make_branch('subdir')
         url = 'http://bazaar-vcs.org/bzr/bzr.dev'
         b.set_parent(url)
         self.assertEqual(url, b.get_parent())
@@ -49,8 +50,9 @@
 
         b.set_parent('../other_branch')
 
-        self.assertEqual(local_path_to_url('../other_branch'), b.get_parent())
-        path = local_path_to_url('../yanb')
+        expected_parent = urlutils.join(self.get_url('subdir'), '../other_branch')
+        self.assertEqual(expected_parent, b.get_parent())
+        path = urlutils.join(self.get_url('subdir'), '../yanb')
         b.set_parent(path)
         self.assertEqual('../yanb', b._get_parent_location())
         self.assertEqual(path, b.get_parent())



More information about the bazaar-commits mailing list