def load_tests(standard_tests, module, loader): supported_scenarios = [] unsupported_scenarios = [] for test_name, scenario_info in all_repository_format_scenarios(): 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 give a re-opened RemoteRepository # with the chosen backing format. if isinstance(format, remote.RemoteRepositoryFormat): with_support = dict(scenario_info) with_support['repository_format'] = RepositoryFormat2a() supported_scenarios.append((test_name + "(Supported)", with_support)) no_support = dict(scenario_info) no_support['repository_format'] = RepositoryFormatKnitPack5() unsupported_scenarios.append((test_name + "(Not Supported)", no_support)) elif format.supports_chks: supported_scenarios.append((test_name, scenario_info)) else: unsupported_scenarios.append((test_name, scenario_info)) result = loader.suiteClass() supported_tests = loader.loadTestsFromModuleNames([ 'bzrlib.tests.per_repository_chk.test_supported']) unsupported_tests = loader.loadTestsFromModuleNames([ 'bzrlib.tests.per_repository_chk.test_unsupported']) multiply_tests(supported_tests, supported_scenarios, result) multiply_tests(unsupported_tests, unsupported_scenarios, result) return result
def all_repository_vf_format_scenarios(): scenarios = [] for test_name, scenario_info in all_repository_format_scenarios(): format = scenario_info['repository_format'] if format.supports_full_versioned_files: scenarios.append((test_name, scenario_info)) return scenarios
def all_repository_vf_format_scenarios(): scenarios = [] for test_name, scenario_info in all_repository_format_scenarios(): format = scenario_info['repository_format'] if format.supports_full_versioned_files: scenarios.append((test_name, scenario_info)) return scenarios
def load_tests(standard_tests, module, loader): supported_scenarios = [] unsupported_scenarios = [] for test_name, scenario_info in all_repository_format_scenarios(): 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 give a re-opened RemoteRepository # with the chosen backing format. if isinstance(format, remote.RemoteRepositoryFormat): with_support = dict(scenario_info) with_support['repository_format'] = RepositoryFormat2a() supported_scenarios.append( (test_name + "(Supported)", with_support)) no_support = dict(scenario_info) no_support['repository_format'] = RepositoryFormatKnitPack5() unsupported_scenarios.append( (test_name + "(Not Supported)", no_support)) elif format.supports_chks: supported_scenarios.append((test_name, scenario_info)) else: unsupported_scenarios.append((test_name, scenario_info)) result = loader.suiteClass() supported_tests = loader.loadTestsFromModuleNames( ['bzrlib.tests.per_repository_chk.test_supported']) unsupported_tests = loader.loadTestsFromModuleNames( ['bzrlib.tests.per_repository_chk.test_unsupported']) multiply_tests(supported_tests, supported_scenarios, result) multiply_tests(unsupported_tests, unsupported_scenarios, result) return result
class SmokeTest(WithScenarios, SSHTestCase): """Smoke test for repository support.""" excluded_scenarios = [ # RepositoryFormat4 is not initializable (bzrlib raises TestSkipped # when you try). 'RepositoryFormat4', # Fetching weave formats from the smart server is known to be broken. # See bug 173807 and bzrlib.tests.test_repository. 'RepositoryFormat5', 'RepositoryFormat6', 'RepositoryFormat7', 'GitRepositoryFormat', 'SvnRepositoryFormat', ] scenarios = [ scenario for scenario in all_repository_format_scenarios() if scenario[0] not in excluded_scenarios and not scenario[0].startswith('RemoteRepositoryFormat') ] def setUp(self): self.scheme = 'bzr+ssh' super(SmokeTest, self).setUp() self.first_tree = 'first' self.second_tree = 'second' def make_branch_specifying_repo_format(self, relpath, repo_format): bd = self.make_bzrdir(relpath, format=self.bzrdir_format) repo_format.initialize(bd) return bd.create_branch() def make_branch_and_tree(self, relpath): b = self.make_branch_specifying_repo_format(relpath, self.repository_format) return b.bzrdir.create_workingtree() def test_smoke(self): # Make a new branch tree = self.make_branch_and_tree(self.first_tree) # Push up a new branch. remote_url = self.getTransportURL('~testuser/+junk/new-branch') self.push(self.first_tree, remote_url) self.assertBranchesMatch(self.first_tree, remote_url) # Commit to it. tree.commit('new revision', allow_pointless=True) # Push it up again. self.push(self.first_tree, remote_url) self.assertBranchesMatch(self.first_tree, remote_url) # Pull it back down. self.branch(remote_url, self.second_tree) self.assertBranchesMatch(self.first_tree, self.second_tree)
def external_reference_test_scenarios(): """Generate test scenarios for repositories supporting external references. """ result = [] for test_name, scenario_info in all_repository_format_scenarios(): format = scenario_info['repository_format'] if (isinstance(format, remote.RemoteRepositoryFormat) or format.supports_external_lookups): result.append((test_name, scenario_info)) return result
def make_smoke_tests(base_suite): from bzrlib.tests.per_repository import ( all_repository_format_scenarios, ) excluded_scenarios = [ # RepositoryFormat4 is not initializable (bzrlib raises TestSkipped # when you try). 'RepositoryFormat4', # Fetching weave formats from the smart server is known to be broken. # See bug 173807 and bzrlib.tests.test_repository. 'RepositoryFormat5', 'RepositoryFormat6', 'RepositoryFormat7', 'GitRepositoryFormat', 'SvnRepositoryFormat', ] scenarios = all_repository_format_scenarios() scenarios = [ scenario for scenario in scenarios if scenario[0] not in excluded_scenarios and not scenario[0].startswith('RemoteRepositoryFormat')] new_suite = unittest.TestSuite() multiply_tests(base_suite, scenarios, new_suite) return new_suite