コード例 #1
0
def load_tests(standard_tests, module, loader):
    test_per_controldir = [
        'bzrlib.tests.per_controldir.test_controldir',
        'bzrlib.tests.per_controldir.test_format',
        'bzrlib.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 bzrlib.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)
コード例 #2
0
ファイル: __init__.py プロジェクト: Distrotech/bzr
def load_tests(standard_tests, module, loader):
    test_per_controldir = [
        'bzrlib.tests.per_controldir.test_controldir',
        'bzrlib.tests.per_controldir.test_format',
        'bzrlib.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 bzrlib.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)
コード例 #3
0
 def test_default_probers(self):
     # If no probers are specified to the constructor
     # of BranchOpener, then a safe set will be used,
     # rather than all probers registered in bzr.
     self.addCleanup(ControlDirFormat.unregister_prober, TrackingProber)
     ControlDirFormat.register_prober(TrackingProber)
     # Open a location without any branches, so that all probers are
     # tried.
     # First, check that the TrackingProber tracks correctly.
     TrackingProber.seen_urls = []
     opener = self.make_branch_opener(["."], probers=[TrackingProber])
     self.assertRaises(NotBranchError, opener.open, ".")
     self.assertEquals(1, len(TrackingProber.seen_urls))
     TrackingProber.seen_urls = []
     # And make sure it's registered in such a way that ControlDir.open would
     # use it.
     self.assertRaises(NotBranchError, ControlDir.open, ".")
     self.assertEquals(1, len(TrackingProber.seen_urls))
コード例 #4
0
 def test_default_probers(self):
     # If no probers are specified to the constructor
     # of BranchOpener, then a safe set will be used,
     # rather than all probers registered in bzr.
     self.addCleanup(ControlDirFormat.unregister_prober, TrackingProber)
     ControlDirFormat.register_prober(TrackingProber)
     # Open a location without any branches, so that all probers are
     # tried.
     # First, check that the TrackingProber tracks correctly.
     TrackingProber.seen_urls = []
     opener = self.make_branch_opener(["."], probers=[TrackingProber])
     self.assertRaises(NotBranchError, opener.open, ".")
     self.assertEqual(1, len(TrackingProber.seen_urls))
     TrackingProber.seen_urls = []
     # And make sure it's registered in such a way that ControlDir.open would
     # use it.
     self.assertRaises(NotBranchError, ControlDir.open, ".")
     self.assertEqual(1, len(TrackingProber.seen_urls))
コード例 #5
0
ファイル: __init__.py プロジェクト: Distrotech/bzr
def load_tests(standard_tests, module, loader):
    colo_supported_formats = []
    colo_unsupported_formats = []
    # This will always add scenarios using the smart server.
    from bzrlib.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([
        'bzrlib.tests.per_controldir_colo.test_supported'])
    unsupported_tests = loader.loadTestsFromModuleNames([
        'bzrlib.tests.per_controldir_colo.test_unsupported'])
    multiply_tests(supported_tests, supported_scenarios, result)
    multiply_tests(unsupported_tests, unsupported_scenarios, result)
    return result
コード例 #6
0
def load_tests(standard_tests, module, loader):
    colo_supported_formats = []
    colo_unsupported_formats = []
    # This will always add scenarios using the smart server.
    from bzrlib.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(
        ['bzrlib.tests.per_controldir_colo.test_supported'])
    unsupported_tests = loader.loadTestsFromModuleNames(
        ['bzrlib.tests.per_controldir_colo.test_unsupported'])
    multiply_tests(supported_tests, supported_scenarios, result)
    multiply_tests(unsupported_tests, unsupported_scenarios, result)
    return result