1291
1291
self.assertEqual('a-tool-which-is-unlikely-to-exist could not be found'
1292
1292
' on this machine', str(e))
1294
def test_windows_tool_reads_both_files(self):
1294
def test_prepare_files_creates_paths_readable_by_windows_tool(self):
1295
1295
self.requireFeature(AttribFeature)
1296
1296
output = StringIO()
1297
1297
tree = self.make_branch_and_tree('tree')
1301
1301
tree.lock_read()
1302
1302
self.addCleanup(tree.unlock)
1303
1303
diff_obj = DiffFromTool(['python', '-c',
1306
proc = subprocess.Popen(["attrib", "%(old_path)s"],
1307
stdout=subprocess.PIPE)
1309
print proc.stdout.read()
1310
proc = subprocess.Popen(["attrib", "%(new_path)s"],
1311
stdout=subprocess.PIPE)
1313
print proc.stdout.read()
1317
diff_obj.diff('file-id', 'file', 'file', 'file', 'file')
1318
lines = output.getvalue()
1319
self.assertContainsRe(lines, r'old\\file')
1320
self.assertContainsRe(lines, r'new\\file')
1304
'print "%(old_path)s %(new_path)s"'],
1306
diff_obj._prepare_files('file-id', 'file', 'file')
1307
self.assertReadableByAttrib(diff_obj._root, 'old\\file', r'old\\file')
1308
self.assertReadableByAttrib(diff_obj._root, 'new\\file', r'new\\file')
1310
def assertReadableByAttrib(self, cwd, relpath, regex):
1311
proc = subprocess.Popen(['attrib', relpath],
1312
stdout=subprocess.PIPE,
1315
result=proc.stdout.read()
1316
self.assertContainsRe(result, regex)
1322
1318
def test_prepare_files(self):
1323
1319
output = StringIO()