Rev 2299: Cleanup imports in http://sourcefrog.net/bzr/resultobj
Martin Pool
mbp at sourcefrog.net
Fri Feb 23 05:45:12 GMT 2007
At http://sourcefrog.net/bzr/resultobj
------------------------------------------------------------
revno: 2299
revision-id: mbp at sourcefrog.net-20070223054511-g9ctoxpgcq0d2sl4
parent: mbp at sourcefrog.net-20070223053935-r601f8e1xwwljm21
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: resultobj
timestamp: Fri 2007-02-23 16:45:11 +1100
message:
Cleanup imports
modified:
bzrlib/tests/test_branch.py test_branch.py-20060116013032-97819aa07b8ab3b5
=== modified file 'bzrlib/tests/test_branch.py'
--- a/bzrlib/tests/test_branch.py 2007-02-15 14:08:23 +0000
+++ b/bzrlib/tests/test_branch.py 2007-02-23 05:45:11 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006 Canonical Ltd
+# Copyright (C) 2005, 2006, 2007 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,9 +30,14 @@
errors,
urlutils,
)
-import bzrlib.branch
-from bzrlib.branch import (BzrBranch5,
- BzrBranchFormat5)
+from bzrlib.branch import (
+ Branch,
+ BranchHooks,
+ BranchFormat,
+ BranchReferenceFormat,
+ BzrBranch5,
+ BzrBranchFormat5,
+ )
from bzrlib.bzrdir import (BzrDirMetaFormat1, BzrDirMeta1,
BzrDir, BzrDirFormat)
from bzrlib.errors import (NotBranchError,
@@ -47,10 +52,10 @@
class TestDefaultFormat(TestCase):
def test_get_set_default_format(self):
- old_format = bzrlib.branch.BranchFormat.get_default_format()
+ old_format = BranchFormat.get_default_format()
# default is 5
- self.assertTrue(isinstance(old_format, bzrlib.branch.BzrBranchFormat5))
- bzrlib.branch.BranchFormat.set_default_format(SampleBranchFormat())
+ self.assertTrue(isinstance(old_format, BzrBranchFormat5))
+ BranchFormat.set_default_format(SampleBranchFormat())
try:
# the default branch format is used by the meta dir format
# which is not the default bzrdir format at this point
@@ -58,8 +63,8 @@
result = dir.create_branch()
self.assertEqual(result, 'A branch')
finally:
- bzrlib.branch.BranchFormat.set_default_format(old_format)
- self.assertEqual(old_format, bzrlib.branch.BranchFormat.get_default_format())
+ BranchFormat.set_default_format(old_format)
+ self.assertEqual(old_format, BranchFormat.get_default_format())
class TestBranchFormat5(TestCaseWithTransport):
@@ -99,7 +104,7 @@
# recursive section - that is, it appends the branch name.
-class SampleBranchFormat(bzrlib.branch.BranchFormat):
+class SampleBranchFormat(BranchFormat):
"""A sample format
this format is initializable, unsupported to aid in testing the
@@ -135,21 +140,21 @@
dir = format._matchingbzrdir.initialize(url)
dir.create_repository()
format.initialize(dir)
- found_format = bzrlib.branch.BranchFormat.find_format(dir)
+ found_format = BranchFormat.find_format(dir)
self.failUnless(isinstance(found_format, format.__class__))
- check_format(bzrlib.branch.BzrBranchFormat5(), "bar")
+ check_format(BzrBranchFormat5(), "bar")
def test_find_format_not_branch(self):
dir = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
self.assertRaises(NotBranchError,
- bzrlib.branch.BranchFormat.find_format,
+ BranchFormat.find_format,
dir)
def test_find_format_unknown_format(self):
dir = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
SampleBranchFormat().initialize(dir)
self.assertRaises(UnknownFormatError,
- bzrlib.branch.BranchFormat.find_format,
+ BranchFormat.find_format,
dir)
def test_register_unregister_format(self):
@@ -159,14 +164,14 @@
# make a branch
format.initialize(dir)
# register a format for it.
- bzrlib.branch.BranchFormat.register_format(format)
+ BranchFormat.register_format(format)
# which branch.Open will refuse (not supported)
- self.assertRaises(UnsupportedFormatError, bzrlib.branch.Branch.open, self.get_url())
+ self.assertRaises(UnsupportedFormatError, Branch.open, self.get_url())
self.make_branch_and_tree('foo')
# but open_downlevel will work
self.assertEqual(format.open(dir), bzrdir.BzrDir.open(self.get_url()).open_branch(unsupported=True))
# unregister the format
- bzrlib.branch.BranchFormat.unregister_format(format)
+ BranchFormat.unregister_format(format)
self.make_branch_and_tree('bar')
def test_checkout_format(self):
@@ -263,7 +268,7 @@
target_branch = dir.create_branch()
t.mkdir('branch')
branch_dir = bzrdirformat.initialize(self.get_url('branch'))
- made_branch = bzrlib.branch.BranchReferenceFormat().initialize(branch_dir, target_branch)
+ made_branch = BranchReferenceFormat().initialize(branch_dir, target_branch)
self.assertEqual(made_branch.base, target_branch.base)
opened_branch = branch_dir.open_branch()
self.assertEqual(opened_branch.base, target_branch.base)
@@ -273,7 +278,7 @@
def test_constructor(self):
"""Check that creating a BranchHooks instance has the right defaults."""
- hooks = bzrlib.branch.BranchHooks()
+ hooks = BranchHooks()
self.assertTrue("set_rh" in hooks, "set_rh not in %s" % hooks)
self.assertTrue("post_push" in hooks, "post_push not in %s" % hooks)
self.assertTrue("post_commit" in hooks, "post_commit not in %s" % hooks)
@@ -283,15 +288,15 @@
def test_installed_hooks_are_BranchHooks(self):
"""The installed hooks object should be a BranchHooks."""
# the installed hooks are saved in self._preserved_hooks.
- self.assertIsInstance(self._preserved_hooks, bzrlib.branch.BranchHooks)
+ self.assertIsInstance(self._preserved_hooks, BranchHooks)
def test_install_hook_raises_unknown_hook(self):
"""install_hook should raise UnknownHook if a hook is unknown."""
- hooks = bzrlib.branch.BranchHooks()
+ hooks = BranchHooks()
self.assertRaises(UnknownHook, hooks.install_hook, 'silly', None)
def test_install_hook_appends_known_hook(self):
"""install_hook should append the callable for known hooks."""
- hooks = bzrlib.branch.BranchHooks()
+ hooks = BranchHooks()
hooks.install_hook('set_rh', None)
self.assertEqual(hooks['set_rh'], [None])
More information about the bazaar-commits
mailing list