~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
193
193
        from bzrlib.bzrdir import BzrDirTestProviderAdapter
194
194
        input_test = TestBzrDirProviderAdapter(
195
195
            "test_adapted_tests")
 
196
        vfs_factory = "v"
196
197
        server1 = "a"
197
198
        server2 = "b"
198
199
        formats = ["c", "d"]
199
 
        adapter = BzrDirTestProviderAdapter(server1, server2, formats)
 
200
        adapter = BzrDirTestProviderAdapter(vfs_factory,
 
201
            server1, server2, formats)
200
202
        suite = adapter.adapt(input_test)
201
203
        tests = list(iter(suite))
202
204
        self.assertEqual(2, len(tests))
203
205
        self.assertEqual(tests[0].bzrdir_format, formats[0])
 
206
        self.assertEqual(tests[0].vfs_transport_factory, vfs_factory)
204
207
        self.assertEqual(tests[0].transport_server, server1)
205
208
        self.assertEqual(tests[0].transport_readonly_server, server2)
206
209
        self.assertEqual(tests[1].bzrdir_format, formats[1])
 
210
        self.assertEqual(tests[1].vfs_transport_factory, vfs_factory)
207
211
        self.assertEqual(tests[1].transport_server, server1)
208
212
        self.assertEqual(tests[1].transport_readonly_server, server2)
209
213
 
233
237
        self.assertEqual(tests[1].transport_server, server1)
234
238
        self.assertEqual(tests[1].transport_readonly_server, server2)
235
239
 
 
240
    def test_setting_vfs_transport(self):
 
241
        """The vfs_transport_factory can be set optionally."""
 
242
        from bzrlib.repository import RepositoryTestProviderAdapter
 
243
        input_test = TestRepositoryProviderAdapter(
 
244
            "test_adapted_tests")
 
245
        formats = [("c", "C")]
 
246
        adapter = RepositoryTestProviderAdapter(None, None, formats,
 
247
            vfs_transport_factory="vfs")
 
248
        suite = adapter.adapt(input_test)
 
249
        tests = list(iter(suite))
 
250
        self.assertEqual(1, len(tests))
 
251
        self.assertEqual(tests[0].vfs_transport_factory, "vfs")
 
252
 
236
253
 
237
254
class TestInterRepositoryProviderAdapter(TestCase):
238
255
    """A group of tests that test the InterRepository test adapter."""