Rev 3740: Test RemoteRepository with and with-out chk index backing formats. in http://people.ubuntu.com/~robertc/baz2.0/repository
Robert Collins
robertc at robertcollins.net
Fri Sep 26 03:32:34 BST 2008
At http://people.ubuntu.com/~robertc/baz2.0/repository
------------------------------------------------------------
revno: 3740
revision-id: robertc at robertcollins.net-20080926023230-fgakdzuk9d3li0tj
parent: robertc at robertcollins.net-20080926020048-x201a3lof0krz9ad
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Fri 2008-09-26 12:32:30 +1000
message:
Test RemoteRepository with and with-out chk index backing formats.
modified:
bzrlib/tests/per_repository_chk/__init__.py __init__.py-20080925061730-e4g24t5xstp2n2vp-2
bzrlib/tests/per_repository_chk/test_supported.py test_supported.py-20080925063728-k65ry0n2rhta6t34-1
bzrlib/tests/per_repository_chk/test_unsupported.py test_unsupported.py-20080925063728-k65ry0n2rhta6t34-2
=== modified file 'bzrlib/tests/per_repository_chk/__init__.py'
--- a/bzrlib/tests/per_repository_chk/__init__.py 2008-09-25 06:41:42 +0000
+++ b/bzrlib/tests/per_repository_chk/__init__.py 2008-09-26 02:32:30 +0000
@@ -28,6 +28,10 @@
remote,
)
from bzrlib.bzrdir import BzrDir
+from bzrlib.repofmt.pack_repo import (
+ RepositoryFormatKnitPack5,
+ RepositoryFormatPackDevelopment3,
+ )
from bzrlib.tests import (
adapt_modules,
adapt_tests,
@@ -40,15 +44,32 @@
)
+class TestCaseWithRepositoryCHK(TestCaseWithRepository):
+
+ def make_repository(self, path):
+ TestCaseWithRepository.make_repository(self, path)
+ return repository.Repository.open(self.get_transport(path).base)
+
+
def load_tests(standard_tests, module, loader):
supported = []
notsupported = []
for test_name, scenario_info in all_repository_format_scenarios():
- # For remote repositories, we need at least one chk
- # capable format to test it:
- # if isinstance(format, remote.RemoteRepositoryFormat):
- # scenario_info['bzrdir_format'].repository_format =
- if scenario_info['repository_format'].supports_chks:
+ format = scenario_info['repository_format']
+ # For remote repositories, we test both with, and without a backing chk
+ # capable format: change the format we use to create the repo to direct
+ # formats, and then the overridden make_repository in
+ # TestCaseWithRepositoryCHK will given a re-opened RemoteRepository
+ # with the chosen backing format.
+ if isinstance(format, remote.RemoteRepositoryFormat):
+ with_support = dict(scenario_info)
+ with_support['repository_format'] = \
+ RepositoryFormatPackDevelopment3()
+ supported.append((test_name + "(Supported)", with_support))
+ no_support = dict(scenario_info)
+ no_support['repository_format'] = RepositoryFormatKnitPack5()
+ notsupported.append((test_name + "(Not Supported)", no_support))
+ elif format.supports_chks:
supported.append((test_name, scenario_info))
else:
notsupported.append((test_name, scenario_info))
=== modified file 'bzrlib/tests/per_repository_chk/test_supported.py'
--- a/bzrlib/tests/per_repository_chk/test_supported.py 2008-09-25 06:41:42 +0000
+++ b/bzrlib/tests/per_repository_chk/test_supported.py 2008-09-26 02:32:30 +0000
@@ -17,10 +17,10 @@
"""Tests for repositories that support CHK indices."""
from bzrlib.versionedfile import VersionedFiles
-from bzrlib.tests.per_repository_chk import TestCaseWithRepository
-
-
-class TestCHKSupport(TestCaseWithRepository):
+from bzrlib.tests.per_repository_chk import TestCaseWithRepositoryCHK
+
+
+class TestCHKSupport(TestCaseWithRepositoryCHK):
def test_chk_bytes_attribute_is_VersionedFiles(self):
repo = self.make_repository('.')
=== modified file 'bzrlib/tests/per_repository_chk/test_unsupported.py'
--- a/bzrlib/tests/per_repository_chk/test_unsupported.py 2008-09-25 06:41:42 +0000
+++ b/bzrlib/tests/per_repository_chk/test_unsupported.py 2008-09-26 02:32:30 +0000
@@ -16,10 +16,10 @@
"""Tests for repositories that do not support CHK indices."""
-from bzrlib.tests.per_repository_chk import TestCaseWithRepository
-
-
-class TestNoCHKSupport(TestCaseWithRepository):
+from bzrlib.tests.per_repository_chk import TestCaseWithRepositoryCHK
+
+
+class TestNoCHKSupport(TestCaseWithRepositoryCHK):
def test_chk_bytes_attribute_is_None(self):
repo = self.make_repository('.')
More information about the bazaar-commits
mailing list