459
459
def get_file(self, file_id):
460
460
return self.get_file_byname(self.id2path(file_id))
462
def get_file_text(self, file_id):
463
return self.get_file(file_id).read()
462
465
def get_file_byname(self, filename):
463
466
return file(self.abspath(filename), 'rb')
1858
1861
self._transport_readonly_server = transport_readonly_server
1859
1862
self._formats = formats
1864
def _clone_test(self, test, bzrdir_format, workingtree_format, variation):
1865
"""Clone test for adaption."""
1866
new_test = deepcopy(test)
1867
new_test.transport_server = self._transport_server
1868
new_test.transport_readonly_server = self._transport_readonly_server
1869
new_test.bzrdir_format = bzrdir_format
1870
new_test.workingtree_format = workingtree_format
1871
def make_new_test_id():
1872
new_id = "%s(%s)" % (test.id(), variation)
1873
return lambda: new_id
1874
new_test.id = make_new_test_id()
1861
1877
def adapt(self, test):
1862
1878
from bzrlib.tests import TestSuite
1863
1879
result = TestSuite()
1864
1880
for workingtree_format, bzrdir_format in self._formats:
1865
new_test = deepcopy(test)
1866
new_test.transport_server = self._transport_server
1867
new_test.transport_readonly_server = self._transport_readonly_server
1868
new_test.bzrdir_format = bzrdir_format
1869
new_test.workingtree_format = workingtree_format
1870
def make_new_test_id():
1871
new_id = "%s(%s)" % (new_test.id(), workingtree_format.__class__.__name__)
1872
return lambda: new_id
1873
new_test.id = make_new_test_id()
1881
new_test = self._clone_test(
1884
workingtree_format, workingtree_format.__class__.__name__)
1874
1885
result.addTest(new_test)