Rev 4724: (vila) (trivial) Cleanup some dpush related tests in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Oct 2 11:10:16 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4724 [merge]
revision-id: pqm at pqm.ubuntu.com-20091002101015-hed4j97ksfqyu4mp
parent: pqm at pqm.ubuntu.com-20091002063037-rj8w0w731ttak0mc
parent: v.ladeuil+lp at free.fr-20091002092734-yp6b2eigepvge832
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2009-10-02 11:10:15 +0100
message:
(vila) (trivial) Cleanup some dpush related tests
modified:
bzrlib/tests/blackbox/test_dpush.py test_dpush.py-20090108125928-st1td6le59g0vyv2-1
bzrlib/tests/blackbox/test_send.py test_bundle.py-20060616222707-c21c8b7ea5ef57b1
bzrlib/tests/test_foreign.py test_foreign.py-20081125004048-ywb901edgp9lluxo-1
=== modified file 'bzrlib/tests/blackbox/test_dpush.py'
--- a/bzrlib/tests/blackbox/test_dpush.py 2009-06-10 03:56:49 +0000
+++ b/bzrlib/tests/blackbox/test_dpush.py 2009-10-02 07:24:29 +0000
@@ -20,48 +20,44 @@
import os
-from bzrlib.branch import (
- Branch,
- InterBranch,
- )
-from bzrlib.bzrdir import (
- BzrDirFormat,
- )
-from bzrlib.foreign import (
- ForeignBranch,
- ForeignRepository,
- )
-from bzrlib.repository import (
- Repository,
- )
-from bzrlib.tests.blackbox import (
- ExternalBase,
+from bzrlib import (
+ branch,
+ bzrdir,
+ foreign,
+ tests,
)
from bzrlib.tests.test_foreign import (
DummyForeignVcsDirFormat,
InterToDummyVcsBranch,
)
-
-
-class TestDpush(ExternalBase):
+from bzrlib.tests import (
+ blackbox,
+ test_foreign,
+ )
+
+class TestDpush(blackbox.ExternalBase):
def setUp(self):
- BzrDirFormat.register_control_format(DummyForeignVcsDirFormat)
- InterBranch.register_optimiser(InterToDummyVcsBranch)
+ bzrdir.BzrDirFormat.register_control_format(
+ test_foreign.DummyForeignVcsDirFormat)
+ branch.InterBranch.register_optimiser(
+ test_foreign.InterToDummyVcsBranch)
self.addCleanup(self.unregister_format)
super(TestDpush, self).setUp()
def unregister_format(self):
try:
- BzrDirFormat.unregister_control_format(DummyForeignVcsDirFormat)
+ bzrdir.BzrDirFormat.unregister_control_format(
+ test_foreign.DummyForeignVcsDirFormat)
except ValueError:
pass
- InterBranch.unregister_optimiser(InterToDummyVcsBranch)
+ branch.InterBranch.unregister_optimiser(
+ test_foreign.InterToDummyVcsBranch)
def make_dummy_builder(self, relpath):
- builder = self.make_branch_builder(relpath,
- format=DummyForeignVcsDirFormat())
- builder.build_snapshot('revid', None,
+ builder = self.make_branch_builder(
+ relpath, format=test_foreign.DummyForeignVcsDirFormat())
+ builder.build_snapshot('revid', None,
[('add', ('', 'TREE_ROOT', 'directory', None)),
('add', ('foo', 'fooid', 'file', 'bar'))])
return builder
@@ -85,9 +81,9 @@
self.check_output("", "status dc")
def test_dpush_new(self):
- branch = self.make_dummy_builder('d').get_branch()
+ b = self.make_dummy_builder('d').get_branch()
- dc = branch.bzrdir.sprout('dc', force_new_repo=True)
+ dc = b.bzrdir.sprout('dc', force_new_repo=True)
self.build_tree_contents([("dc/foofile", "blaaaa")])
dc_tree = dc.open_workingtree()
dc_tree.add("foofile")
@@ -98,9 +94,9 @@
self.check_output("", "status dc")
def test_dpush_wt_diff(self):
- branch = self.make_dummy_builder('d').get_branch()
+ b = self.make_dummy_builder('d').get_branch()
- dc = branch.bzrdir.sprout('dc', force_new_repo=True)
+ dc = b.bzrdir.sprout('dc', force_new_repo=True)
self.build_tree_contents([("dc/foofile", "blaaaa")])
dc_tree = dc.open_workingtree()
dc_tree.add("foofile")
@@ -114,9 +110,9 @@
def test_diverged(self):
builder = self.make_dummy_builder('d')
- branch = builder.get_branch()
+ b = builder.get_branch()
- dc = branch.bzrdir.sprout('dc', force_new_repo=True)
+ dc = b.bzrdir.sprout('dc', force_new_repo=True)
dc_tree = dc.open_workingtree()
self.build_tree_contents([("dc/foo", "bar")])
=== modified file 'bzrlib/tests/blackbox/test_send.py'
--- a/bzrlib/tests/blackbox/test_send.py 2009-09-17 11:54:41 +0000
+++ b/bzrlib/tests/blackbox/test_send.py 2009-10-02 07:24:29 +0000
@@ -423,7 +423,7 @@
self.assertSendFails([])
self.assertSendSucceeds(['--no-strict'])
- def test_push_strict_command_line_override_config(self):
+ def test_send_strict_command_line_override_config(self):
self.set_config_send_strict('false')
self.assertSendSucceeds([])
self.assertSendFails(['--strict'])
=== modified file 'bzrlib/tests/test_foreign.py'
--- a/bzrlib/tests/test_foreign.py 2009-08-17 07:54:34 +0000
+++ b/bzrlib/tests/test_foreign.py 2009-10-02 09:27:34 +0000
@@ -20,28 +20,15 @@
from bzrlib import (
branch,
+ bzrdir,
errors,
foreign,
lockable_files,
lockdir,
+ revision,
+ tests,
trace,
)
-from bzrlib.bzrdir import (
- BzrDir,
- BzrDirFormat,
- BzrDirMeta1,
- BzrDirMetaFormat1,
- format_registry,
- )
-from bzrlib.inventory import Inventory
-from bzrlib.revision import (
- NULL_REVISION,
- Revision,
- )
-from bzrlib.tests import (
- TestCase,
- TestCaseWithTransport,
- )
# This is the dummy foreign revision control system, used
# mainly here in the testsuite to test the foreign VCS infrastructure.
@@ -136,7 +123,7 @@
(str(rev.timestamp), str(rev.timezone),
str(self.target.revno())))
parent_revno, parent_revid= self.target.last_revision_info()
- if parent_revid == NULL_REVISION:
+ if parent_revid == revision.NULL_REVISION:
parent_revids = []
else:
parent_revids = [parent_revid]
@@ -192,7 +179,7 @@
raise errors.NotBranchError(path=transport.base)
-class DummyForeignVcsDirFormat(BzrDirMetaFormat1):
+class DummyForeignVcsDirFormat(bzrdir.BzrDirMetaFormat1):
"""BzrDirFormat for the dummy foreign VCS."""
@classmethod
@@ -239,7 +226,7 @@
return DummyForeignVcsDir(transport, self)
-class DummyForeignVcsDir(BzrDirMeta1):
+class DummyForeignVcsDir(bzrdir.BzrDirMeta1):
def __init__(self, _transport, _format):
self._format = _format
@@ -254,7 +241,7 @@
def cloning_metadir(self, stacked=False):
"""Produce a metadir suitable for cloning with."""
- return format_registry.make_bzrdir("default")
+ return bzrdir.format_registry.make_bzrdir("default")
def sprout(self, url, revision_id=None, force_new_repo=False,
recurse='down', possible_transports=None,
@@ -268,7 +255,7 @@
hardlink=hardlink, stacked=stacked, source_branch=source_branch)
-class ForeignVcsRegistryTests(TestCase):
+class ForeignVcsRegistryTests(tests.TestCase):
"""Tests for the ForeignVcsRegistry class."""
def test_parse_revision_id_no_dash(self):
@@ -289,7 +276,7 @@
reg.parse_revision_id("dummy-v1:some-foreign-revid"))
-class ForeignRevisionTests(TestCase):
+class ForeignRevisionTests(tests.TestCase):
"""Tests for the ForeignRevision class."""
def test_create(self):
@@ -301,7 +288,7 @@
self.assertEquals(mapp, rev.mapping)
-class WorkingTreeFileUpdateTests(TestCaseWithTransport):
+class WorkingTreeFileUpdateTests(tests.TestCaseWithTransport):
"""Tests for update_workingtree_fileids()."""
def test_update_workingtree(self):
@@ -325,18 +312,19 @@
wt.unlock()
-class DummyForeignVcsTests(TestCaseWithTransport):
+class DummyForeignVcsTests(tests.TestCaseWithTransport):
"""Very basic test for DummyForeignVcs."""
def setUp(self):
- BzrDirFormat.register_control_format(DummyForeignVcsDirFormat)
+ bzrdir.BzrDirFormat.register_control_format(DummyForeignVcsDirFormat)
branch.InterBranch.register_optimiser(InterToDummyVcsBranch)
self.addCleanup(self.unregister)
super(DummyForeignVcsTests, self).setUp()
def unregister(self):
try:
- BzrDirFormat.unregister_control_format(DummyForeignVcsDirFormat)
+ bzrdir.BzrDirFormat.unregister_control_format(
+ DummyForeignVcsDirFormat)
except ValueError:
pass
branch.InterBranch.unregister_optimiser(InterToDummyVcsBranch)
@@ -344,7 +332,7 @@
def test_create(self):
"""Test we can create dummies."""
self.make_branch_and_tree("d", format=DummyForeignVcsDirFormat())
- dir = BzrDir.open("d")
+ dir = bzrdir.BzrDir.open("d")
self.assertEquals("A Dummy VCS Dir", dir._format.get_format_string())
dir.open_repository()
dir.open_branch()
@@ -353,17 +341,18 @@
def test_sprout(self):
"""Test we can clone dummies and that the format is not preserved."""
self.make_branch_and_tree("d", format=DummyForeignVcsDirFormat())
- dir = BzrDir.open("d")
+ dir = bzrdir.BzrDir.open("d")
newdir = dir.sprout("e")
- self.assertNotEquals("A Dummy VCS Dir", newdir._format.get_format_string())
+ self.assertNotEquals("A Dummy VCS Dir",
+ newdir._format.get_format_string())
def test_lossy_push_empty(self):
source_tree = self.make_branch_and_tree("source")
target_tree = self.make_branch_and_tree("target",
format=DummyForeignVcsDirFormat())
pushresult = source_tree.branch.lossy_push(target_tree.branch)
- self.assertEquals(NULL_REVISION, pushresult.old_revid)
- self.assertEquals(NULL_REVISION, pushresult.new_revid)
+ self.assertEquals(revision.NULL_REVISION, pushresult.old_revid)
+ self.assertEquals(revision.NULL_REVISION, pushresult.new_revid)
self.assertEquals({}, pushresult.revidmap)
def test_lossy_push_simple(self):
@@ -378,7 +367,7 @@
pushresult = source_tree.branch.lossy_push(target_tree.branch)
finally:
target_tree.branch.unlock()
- self.assertEquals(NULL_REVISION, pushresult.old_revid)
+ self.assertEquals(revision.NULL_REVISION, pushresult.old_revid)
self.assertEquals({revid1:target_tree.branch.last_revision()},
pushresult.revidmap)
self.assertEquals(pushresult.revidmap[revid1], pushresult.new_revid)
More information about the bazaar-commits
mailing list