Rev 5823: (jelmer) Move more tests that require the full versioned files API to in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed May 4 19:07:35 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5823 [merge]
revision-id: pqm at pqm.ubuntu.com-20110504190644-xt0ebtkasp1rnfkc
parent: pqm at pqm.ubuntu.com-20110504173809-otz0gw0cvf2z9jbk
parent: jelmer at samba.org-20110502224440-ko1b75qi9ccsx49u
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-05-04 19:06:44 +0000
message:
(jelmer) Move more tests that require the full versioned files API to
bzrlib.tests.per_repository_vf. (Jelmer Vernooij)
added:
bzrlib/tests/per_repository_vf/test_fetch.py test_fetch.py-20110502224423-n9z98pc48jrd4tt8-1
renamed:
bzrlib/tests/per_repository/test_add_inventory_by_delta.py => bzrlib/tests/per_repository_vf/test_add_inventory_by_delta.py test_add_inventory_d-20081013002626-rut81igtlqb4590z-1
modified:
bzrlib/tests/per_repository/__init__.py __init__.py-20060131092037-9564957a7d4a841b
bzrlib/tests/per_repository/test_add_fallback_repository.py test_add_fallback_re-20080215040003-8w9n4ck9uqdxj18m-1
bzrlib/tests/per_repository/test_fetch.py test_fetch.py-20070814052151-5cxha9slx4c93uog-1
bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
bzrlib/tests/per_repository_vf/__init__.py __init__.py-20110224144010-ukgfmlxcgsibq4u4-2
bzrlib/tests/per_repository_vf/test_repository.py test_repository.py-20110224144010-ukgfmlxcgsibq4u4-3
bzrlib/tests/per_repository_vf/test_add_inventory_by_delta.py test_add_inventory_d-20081013002626-rut81igtlqb4590z-1
=== modified file 'bzrlib/tests/per_repository/__init__.py'
--- a/bzrlib/tests/per_repository/__init__.py 2011-03-09 01:33:12 +0000
+++ b/bzrlib/tests/per_repository/__init__.py 2011-05-02 22:39:15 +0000
@@ -110,7 +110,6 @@
prefix = 'bzrlib.tests.per_repository.'
test_repository_modules = [
'test_add_fallback_repository',
- 'test_add_inventory_by_delta',
'test_break_lock',
'test_check',
'test_commit_builder',
=== modified file 'bzrlib/tests/per_repository/test_add_fallback_repository.py'
--- a/bzrlib/tests/per_repository/test_add_fallback_repository.py 2009-08-13 05:17:12 +0000
+++ b/bzrlib/tests/per_repository/test_add_fallback_repository.py 2011-05-02 22:39:15 +0000
@@ -17,9 +17,7 @@
"""Tests for Repository.add_fallback_repository."""
from bzrlib import (
- bzrdir,
errors,
- remote,
)
from bzrlib.revision import NULL_REVISION
from bzrlib.tests import TestNotApplicable
=== modified file 'bzrlib/tests/per_repository/test_fetch.py'
--- a/bzrlib/tests/per_repository/test_fetch.py 2011-04-02 20:53:50 +0000
+++ b/bzrlib/tests/per_repository/test_fetch.py 2011-05-02 22:44:40 +0000
@@ -20,7 +20,6 @@
bzrdir,
errors,
gpg,
- graph,
remote,
repository,
tests,
@@ -356,29 +355,3 @@
self.addCleanup(source.unlock)
target.fetch(source, revision_id='B-id')
-
-class TestSource(TestCaseWithRepository):
- """Tests for/about the results of Repository._get_source."""
-
- def test_no_absent_records_in_stream_with_ghosts(self):
- # XXX: Arguably should be in per_interrepository but
- # doesn't actually gain coverage there; need a specific set of
- # permutations to cover it.
- # bug lp:376255 was reported about this.
- builder = self.make_branch_builder('repo')
- builder.start_series()
- builder.build_snapshot('tip', ['ghost'],
- [('add', ('', 'ROOT_ID', 'directory', ''))],
- allow_leftmost_as_ghost=True)
- builder.finish_series()
- b = builder.get_branch()
- b.lock_read()
- self.addCleanup(b.unlock)
- repo = b.repository
- source = repo._get_source(repo._format)
- search = graph.PendingAncestryResult(['tip'], repo)
- stream = source.get_stream(search)
- for substream_type, substream in stream:
- for record in substream:
- self.assertNotEqual('absent', record.storage_kind,
- "Absent record for %s" % (((substream_type,) + record.key),))
=== modified file 'bzrlib/tests/per_repository/test_repository.py'
--- a/bzrlib/tests/per_repository/test_repository.py 2011-04-20 00:11:42 +0000
+++ b/bzrlib/tests/per_repository/test_repository.py 2011-05-04 19:06:44 +0000
@@ -759,27 +759,6 @@
self.assertEquals(inv_sha1, repo.get_revision('A').inventory_sha1)
repo.unlock()
- def test_install_revisions(self):
- wt = self.make_branch_and_tree('source')
- wt.commit('A', allow_pointless=True, rev_id='A')
- repo = wt.branch.repository
- repo.lock_write()
- repo.start_write_group()
- repo.sign_revision('A', gpg.LoopbackGPGStrategy(None))
- repo.commit_write_group()
- repo.unlock()
- repo.lock_read()
- self.addCleanup(repo.unlock)
- repo2 = self.make_repository('repo2')
- revision = repo.get_revision('A')
- tree = repo.revision_tree('A')
- signature = repo.get_signature_text('A')
- repo2.lock_write()
- self.addCleanup(repo2.unlock)
- repository.install_revisions(repo2, [(revision, tree, signature)])
- self.assertEqual(revision, repo2.get_revision('A'))
- self.assertEqual(signature, repo2.get_signature_text('A'))
-
# XXX: this helper duplicated from tests.test_repository
def make_remote_repository(self, path, shared=False):
"""Make a RemoteRepository object backed by a real repository that will
=== modified file 'bzrlib/tests/per_repository_vf/__init__.py'
--- a/bzrlib/tests/per_repository_vf/__init__.py 2011-04-19 12:48:51 +0000
+++ b/bzrlib/tests/per_repository_vf/__init__.py 2011-05-02 22:44:40 +0000
@@ -37,8 +37,10 @@
def load_tests(basic_tests, module, loader):
testmod_names = [
+ 'test_add_inventory_by_delta',
'test_check',
'test_check_reconcile',
+ 'test_fetch',
'test_reconcile',
'test_repository',
]
=== renamed file 'bzrlib/tests/per_repository/test_add_inventory_by_delta.py' => 'bzrlib/tests/per_repository_vf/test_add_inventory_by_delta.py'
--- a/bzrlib/tests/per_repository/test_add_inventory_by_delta.py 2009-06-18 18:18:36 +0000
+++ b/bzrlib/tests/per_repository_vf/test_add_inventory_by_delta.py 2011-05-02 22:39:15 +0000
@@ -17,11 +17,19 @@
"""Tests for Repository.add_inventory_by_delta."""
from bzrlib import errors, revision
-from bzrlib.tests.per_repository import TestCaseWithRepository
+from bzrlib.tests.per_repository_vf import (
+ all_repository_vf_format_scenarios,
+ TestCaseWithRepository
+ )
+from bzrlib.tests.scenarios import load_tests_apply_scenarios
+
+load_tests = load_tests_apply_scenarios
class TestAddInventoryByDelta(TestCaseWithRepository):
+ scenarios = all_repository_vf_format_scenarios()
+
def _get_repo_in_write_group(self, path='repository'):
repo = self.make_repository(path)
repo.lock_write()
=== added file 'bzrlib/tests/per_repository_vf/test_fetch.py'
--- a/bzrlib/tests/per_repository_vf/test_fetch.py 1970-01-01 00:00:00 +0000
+++ b/bzrlib/tests/per_repository_vf/test_fetch.py 2011-05-02 22:44:40 +0000
@@ -0,0 +1,57 @@
+# Copyright (C) 2007-2011 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+"""Tests for fetch between repositories of the same type."""
+
+from bzrlib import (
+ graph,
+ )
+from bzrlib.tests.per_repository_vf import (
+ TestCaseWithRepository,
+ all_repository_vf_format_scenarios,
+ )
+from bzrlib.tests.scenarios import load_tests_apply_scenarios
+
+load_tests = load_tests_apply_scenarios
+
+
+class TestSource(TestCaseWithRepository):
+ """Tests for/about the results of Repository._get_source."""
+
+ scenarios = all_repository_vf_format_scenarios()
+
+ def test_no_absent_records_in_stream_with_ghosts(self):
+ # XXX: Arguably should be in per_interrepository but
+ # doesn't actually gain coverage there; need a specific set of
+ # permutations to cover it.
+ # bug lp:376255 was reported about this.
+ builder = self.make_branch_builder('repo')
+ builder.start_series()
+ builder.build_snapshot('tip', ['ghost'],
+ [('add', ('', 'ROOT_ID', 'directory', ''))],
+ allow_leftmost_as_ghost=True)
+ builder.finish_series()
+ b = builder.get_branch()
+ b.lock_read()
+ self.addCleanup(b.unlock)
+ repo = b.repository
+ source = repo._get_source(repo._format)
+ search = graph.PendingAncestryResult(['tip'], repo)
+ stream = source.get_stream(search)
+ for substream_type, substream in stream:
+ for record in substream:
+ self.assertNotEqual('absent', record.storage_kind,
+ "Absent record for %s" % (((substream_type,) + record.key),))
=== modified file 'bzrlib/tests/per_repository_vf/test_repository.py'
--- a/bzrlib/tests/per_repository_vf/test_repository.py 2011-03-14 00:09:25 +0000
+++ b/bzrlib/tests/per_repository_vf/test_repository.py 2011-05-02 22:39:15 +0000
@@ -18,6 +18,8 @@
from bzrlib import (
errors,
+ gpg,
+ repository as _mod_repository,
tests,
versionedfile,
)
@@ -112,6 +114,27 @@
self.assertRaises(errors.ObjectNotLocked,
inventories.add_lines, ('foo',), [], [])
+ def test_install_revisions(self):
+ wt = self.make_branch_and_tree('source')
+ wt.commit('A', allow_pointless=True, rev_id='A')
+ repo = wt.branch.repository
+ repo.lock_write()
+ repo.start_write_group()
+ repo.sign_revision('A', gpg.LoopbackGPGStrategy(None))
+ repo.commit_write_group()
+ repo.unlock()
+ repo.lock_read()
+ self.addCleanup(repo.unlock)
+ repo2 = self.make_repository('repo2')
+ revision = repo.get_revision('A')
+ tree = repo.revision_tree('A')
+ signature = repo.get_signature_text('A')
+ repo2.lock_write()
+ self.addCleanup(repo2.unlock)
+ _mod_repository.install_revisions(repo2, [(revision, tree, signature)])
+ self.assertEqual(revision, repo2.get_revision('A'))
+ self.assertEqual(signature, repo2.get_signature_text('A'))
+
class TestCaseWithComplexRepository(TestCaseWithRepository):
More information about the bazaar-commits
mailing list