def load_tests(loader, standard_tests, pattern): 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( ['breezy.tests.per_repository_chk.test_supported']) unsupported_tests = loader.loadTestsFromModuleNames( ['breezy.tests.per_repository_chk.test_unsupported']) multiply_tests(supported_tests, supported_scenarios, result) multiply_tests(unsupported_tests, unsupported_scenarios, result) return result
def load_tests(basic_tests, module, loader): result = loader.suiteClass() prefix = "breezy.plugins.svn.tests.mapping_implementations" modules = ['test_base', 'test_branch', 'test_repository'] module_name_list = ["%s.%s" % (prefix, m) for m in modules] format_scenarios = [] for name in mapping_registry.keys(): format_scenarios.append((name, {'mapping_name': name})) multiply_tests(loader.loadTestsFromModuleNames(module_name_list), format_scenarios, result) return result
def load_tests(loader, standard_tests, pattern): result = loader.suiteClass() per_vcs_mod_names = [ 'branch', 'repository', ] sub_tests = loader.loadTestsFromModuleNames([ 'breezy.tests.per_foreign_vcs.test_' + name for name in per_vcs_mod_names ]) tests.multiply_tests(sub_tests, vcs_scenarios(), result) return result
def load_tests(loader, standard_tests, pattern): per_branch_mod_names = [ 'branch', 'break_lock', 'check', 'config', 'create_checkout', 'create_clone', 'commit', 'dotted_revno_to_revision_id', 'get_revision_id_to_revno_map', 'hooks', 'http', 'iter_merge_sorted_revisions', 'last_revision_info', 'locking', 'parent', 'permissions', 'pull', 'push', 'reconcile', 'revision_id_to_dotted_revno', 'revision_id_to_revno', 'sprout', 'stacking', 'tags', 'uncommit', 'update', ] sub_tests = loader.loadTestsFromModuleNames([ 'breezy.tests.per_branch.test_' + name for name in per_branch_mod_names ]) return tests.multiply_tests(sub_tests, branch_scenarios(), standard_tests)
def load_tests(loader, standard_tests, pattern): prefix = 'breezy.tests.per_repository.' test_repository_modules = [ 'test_add_fallback_repository', 'test_break_lock', 'test_check', 'test_commit_builder', 'test_fetch', 'test_file_graph', 'test_get_parent_map', 'test_get_rev_id_for_revno', 'test_has_same_location', 'test_has_revisions', 'test_locking', 'test_pack', 'test_reconcile', 'test_refresh_data', 'test_repository', 'test_revision', 'test_signatures', 'test_statistics', 'test_write_group', ] # Parameterize per_repository test modules by format. submod_tests = loader.loadTestsFromModuleNames( [prefix + module_name for module_name in test_repository_modules]) format_scenarios = all_repository_format_scenarios() return multiply_tests(submod_tests, format_scenarios, standard_tests)
def load_tests(loader, standard_tests, pattern): per_tree_mod_names = [ 'archive', 'annotate_iter', 'export', 'get_file_mtime', 'get_file_with_stat', 'get_root_id', 'get_symlink_target', 'ids', 'iter_search_rules', 'is_executable', 'list_files', 'locking', 'path_content_summary', 'revision_tree', 'symlinks', 'test_trees', 'transform', 'tree', 'walkdirs', ] submod_tests = loader.loadTestsFromModuleNames( [__name__ + '.test_' + name for name in per_tree_mod_names]) scenarios = make_scenarios( tests.default_transport, # None here will cause a readonly decorator to be created # by the TestCaseWithTransport.get_readonly_transport method. None, format_registry._get_all()) # add the tests for the sub modules return tests.multiply_tests(submod_tests, scenarios, standard_tests)
def load_tests(loader, standard_tests, pattern): test_per_controldir = [ 'breezy.tests.per_controldir.test_controldir', 'breezy.tests.per_controldir.test_format', 'breezy.tests.per_controldir.test_push', ] submod_tests = loader.loadTestsFromModuleNames(test_per_controldir) formats = ControlDirFormat.known_formats() scenarios = make_scenarios( default_transport, None, # None here will cause a readonly decorator to be created # by the TestCaseWithTransport.get_readonly_transport method. None, formats) # This will always add scenarios using the smart server. from breezy.bzr.remote import RemoteBzrDirFormat # test the remote server behaviour when backed with a MemoryTransport # Once for the current version scenarios.extend( make_scenarios(memory.MemoryServer, test_server.SmartTCPServer_for_testing, test_server.ReadonlySmartTCPServer_for_testing, [(RemoteBzrDirFormat())], name_suffix='-default')) # And once with < 1.6 - the 'v2' protocol. scenarios.extend( make_scenarios(memory.MemoryServer, test_server.SmartTCPServer_for_testing_v2_only, test_server.ReadonlySmartTCPServer_for_testing_v2_only, [(RemoteBzrDirFormat())], name_suffix='-v2')) # add the tests for the sub modules return multiply_tests(submod_tests, scenarios, standard_tests)
def load_tests(loader, basic_tests, pattern): """Generate suite containing all parameterized tests""" modules_to_test = [ 'breezy.bzr.tests.per_inventory.basics', ] from breezy.bzr.inventory import Inventory, CHKInventory def inv_to_chk_inv(test, inv): """CHKInventory needs a backing VF, so we create one.""" factory = groupcompress.make_pack_factory(True, True, 1) trans = test.get_transport('chk-inv') trans.ensure_base() vf = factory(trans) # We intentionally use a non-standard maximum_size, so that we are more # likely to trigger splits, and get increased test coverage. chk_inv = CHKInventory.from_inventory(vf, inv, maximum_size=100, search_key_name=b'hash-255-way') return chk_inv scenarios = [('Inventory', {'_inventory_class': Inventory, '_inv_to_test_inv': lambda test, inv: inv }), ('CHKInventory', {'_inventory_class': CHKInventory, '_inv_to_test_inv': inv_to_chk_inv, })] # add the tests for the sub modules return tests.multiply_tests( loader.loadTestsFromModuleNames(modules_to_test), scenarios, basic_tests)
def load_tests(loader, basic_tests, pattern): result = loader.suiteClass() tree_tests, remaining_tests = tests.split_suite_by_condition( basic_tests, tests.condition_isinstance((TestTreeWidget, ))) tests.multiply_tests(tree_tests, tree_scenarios, result) filter_tests, remaining_tests = tests.split_suite_by_condition( remaining_tests, tests.condition_isinstance((TestTreeFilterProxyModel, ))) tests.multiply_tests(filter_tests, filter_scenarios, result) # No parametrization for the remaining tests result.addTests(remaining_tests) return result
def load_tests(loader, standard_tests, pattern): default_tree_format = WorkingTreeFormat3() submod_tests = loader.loadTestsFromModuleNames([ 'breezy.tests.per_intertree.test_compare', 'breezy.tests.per_intertree.test_file_content_matches', 'breezy.tests.per_intertree.test_find_path', ]) test_intertree_permutations = [ # test InterTree with two default-format working trees. (inventorytree.InterInventoryTree.__name__, inventorytree.InterInventoryTree, default_tree_format, default_tree_format, return_provided_trees) ] for optimiser in InterTree.iter_optimisers(): if optimiser is inventorytree.InterCHKRevisionTree: # XXX: we shouldn't use an Intertree object to detect inventories # -- vila 20090311 chk_tree_format = WorkingTreeFormat4() chk_tree_format._get_matchingcontroldir = \ lambda: breezy.controldir.format_registry.make_controldir('2a') test_intertree_permutations.append( (inventorytree.InterInventoryTree.__name__ + "(CHKInventory)", inventorytree.InterInventoryTree, chk_tree_format, chk_tree_format, mutable_trees_to_revision_trees)) elif optimiser is breezy.bzr.workingtree_4.InterDirStateTree: # Its a little ugly to be conditional here, but less so than having # the optimiser listed twice. # Add once, compiled version test_intertree_permutations.append( (optimiser.__name__ + "(C)", optimiser, optimiser._matching_from_tree_format, optimiser._matching_to_tree_format, optimiser.make_source_parent_tree_compiled_dirstate)) # python version test_intertree_permutations.append( (optimiser.__name__ + "(PY)", optimiser, optimiser._matching_from_tree_format, optimiser._matching_to_tree_format, optimiser.make_source_parent_tree_python_dirstate)) elif (optimiser._matching_from_tree_format is not None and optimiser._matching_to_tree_format is not None): test_intertree_permutations.append( (optimiser.__name__, optimiser, optimiser._matching_from_tree_format, optimiser._matching_to_tree_format, optimiser._test_mutable_trees_to_test_trees)) # PreviewTree does not have an InterTree optimiser class. test_intertree_permutations.append( (inventorytree.InterInventoryTree.__name__ + "(PreviewTree)", inventorytree.InterInventoryTree, default_tree_format, default_tree_format, mutable_trees_to_preview_trees)) scenarios = make_scenarios( default_transport, # None here will cause a readonly decorator to be created # by the TestCaseWithTransport.get_readonly_transport method. None, test_intertree_permutations) # add the tests for the sub modules to the standard tests. return multiply_tests(submod_tests, scenarios, standard_tests)
def load_tests(loader, standard_tests, pattern): submod_tests = loader.loadTestsFromModuleNames([ 'breezy.tests.per_lock.test_lock', 'breezy.tests.per_lock.test_temporary_write_lock', ]) scenarios = make_scenarios(lock._lock_classes) # add the tests for the sub modules return tests.multiply_tests(submod_tests, scenarios, standard_tests)
def load_tests(loader, standard_tests, pattern): test_names = [ 'add_reference', 'add', 'annotate_iter', 'basis_inventory', 'basis_tree', 'break_lock', 'canonical_path', 'changes_from', 'check', 'check_state', 'content_filters', 'commit', 'eol_conversion', 'executable', 'flush', 'get_file_mtime', 'get_parent_ids', 'inv', 'is_control_filename', 'is_ignored', 'locking', 'merge_from_branch', 'mkdir', 'move', 'nested_specifics', 'parents', 'paths2ids', 'pull', 'put_file', 'readonly', 'read_working_inventory', 'remove', 'rename_one', 'revision_tree', 'set_root_id', 'shelf_manager', 'smart_add', 'symlinks', 'transform', 'uncommit', 'unversion', 'views', 'walkdirs', 'workingtree', ] test_workingtree_implementations = [ 'breezy.tests.per_workingtree.test_' + name for name in test_names] scenarios = wt_scenarios() # add the tests for the sub modules return tests.multiply_tests( loader.loadTestsFromModuleNames(test_workingtree_implementations), scenarios, standard_tests)
def load_tests(loader, standard_tests, pattern): submod_tests = loader.loadTestsFromModuleNames([ 'breezy.tests.per_interbranch.test_fetch', 'breezy.tests.per_interbranch.test_get', 'breezy.tests.per_interbranch.test_copy_content_into', 'breezy.tests.per_interbranch.test_pull', 'breezy.tests.per_interbranch.test_push', ]) scenarios = make_scenarios(default_test_list()) return multiply_tests(submod_tests, scenarios, standard_tests)
def load_tests(loader, standard_tests, pattern): submod_tests = loader.loadTestsFromModuleNames([ 'breezy.tests.per_interrepository.test_fetch', 'breezy.tests.per_interrepository.test_interrepository', ]) scenarios = make_scenarios( default_transport, # None here will cause a readonly decorator to be created # by the TestCaseWithTransport.get_readonly_transport method. None, default_test_list()) return multiply_tests(submod_tests, scenarios, standard_tests)
def load_tests(loader, standard_tests, pattern): colo_supported_formats = [] colo_unsupported_formats = [] # This will always add scenarios using the smart server. from breezy.bzr.remote import RemoteBzrDirFormat for format in ControlDirFormat.known_formats(): if isinstance(format, RemoteBzrDirFormat): continue if format.colocated_branches: colo_supported_formats.append(format) else: colo_unsupported_formats.append(format) supported_scenarios = make_scenarios(default_transport, None, None, colo_supported_formats) unsupported_scenarios = make_scenarios(default_transport, None, None, colo_unsupported_formats) # test the remote server behaviour when backed with a MemoryTransport # Once for the current version unsupported_scenarios.extend( make_scenarios(memory.MemoryServer, test_server.SmartTCPServer_for_testing, test_server.ReadonlySmartTCPServer_for_testing, [(RemoteBzrDirFormat())], name_suffix='-default')) # And once with < 1.6 - the 'v2' protocol. unsupported_scenarios.extend( make_scenarios(memory.MemoryServer, test_server.SmartTCPServer_for_testing_v2_only, test_server.ReadonlySmartTCPServer_for_testing_v2_only, [(RemoteBzrDirFormat())], name_suffix='-v2')) result = loader.suiteClass() supported_tests = loader.loadTestsFromModuleNames( ['breezy.tests.per_controldir_colo.test_supported']) unsupported_tests = loader.loadTestsFromModuleNames( ['breezy.tests.per_controldir_colo.test_unsupported']) multiply_tests(supported_tests, supported_scenarios, result) multiply_tests(unsupported_tests, unsupported_scenarios, result) return result
def load_tests(loader, standard_tests, pattern): module_list = [ 'breezy.tests.per_repository_reference.test_add_inventory', 'breezy.tests.per_repository_reference.test_add_revision', 'breezy.tests.per_repository_reference.test_add_signature_text', 'breezy.tests.per_repository_reference.test_all_revision_ids', 'breezy.tests.per_repository_reference.test_break_lock', 'breezy.tests.per_repository_reference.test_check', 'breezy.tests.per_repository_reference.test_commit_with_stacking', 'breezy.tests.per_repository_reference.test_default_stacking', 'breezy.tests.per_repository_reference.test_fetch', 'breezy.tests.per_repository_reference.test_get_record_stream', 'breezy.tests.per_repository_reference.test_get_rev_id_for_revno', 'breezy.tests.per_repository_reference.test_graph', 'breezy.tests.per_repository_reference.test_initialize', 'breezy.tests.per_repository_reference.test__make_parents_provider', 'breezy.tests.per_repository_reference.test_unlock', ] # Parameterize per_repository_reference test modules by format. standard_tests.addTests(loader.loadTestsFromModuleNames(module_list)) return multiply_tests(standard_tests, external_reference_test_scenarios(), loader.suiteClass())
def test_multiply_tests(self): loader = TestLoader() suite = loader.suiteClass() multiply_tests(self, vary_by_color(), suite) self.assertEqual(['blue', 'green', 'red'], get_generated_test_attributes(suite, 'color'))