[Zope3-dev] test_merge_diff3 unit test failure
Dave Harris
dpharris76 at msn.com
Thu Jan 22 23:11:00 EST 2004
I included this failure in my Windows XP unit test report a couple of days
ago and I've identified the source of the failure. Here's the traceback:
======================================================================
FAIL: test_merge_diff3 (zope.fssync.tests.test_fsmerger.TestFSMerger)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\sf\Zope3\src\zope\fssync\tests\test_fsmerger.py", line 267, in
test_merge_diff3
self.entry, self.entry)
File "D:\sf\Zope3\src\zope\fssync\tests\test_fsmerger.py", line 234, in
mergetest
self.assertEqual(filtered_reports, expected_reports)
File "C:\PYTHON23\Lib\unittest.py", line 302, in failUnlessEqual
raise self.failureException, \
AssertionError: ['C
c:\\docume~1\\owner\\locals~1\\temp\\tmpxih9yg\\local\\foo'] != ['M
c:\\docume~1\\owner\\locals~1\\temp\\tmpxih9yg\\local\\foo']
----------------------------------------------------------------------
The root of the problem is the diff3 / popen() combination in the function
merge_files_merge() in fssync/merger.py:
def merge_files_merge(self, local, original, remote):
# XXX This is platform dependent
if exists(original):
origfile = original
else:
origfile = "/dev/null"
# commands.mkarg() is undocumented; maybe use fssync.quote()
cmd = "diff3 -m -E %s %s %s" % (commands.mkarg(local),
commands.mkarg(origfile),
commands.mkarg(remote))
pipe = os.popen(cmd, "r")
output = pipe.read()
sts = pipe.close()
......
The mkarg() calls place quotes around each of the file names, which the
Windows diff3 command finds distasteful. Using pdb, I traced down to the
popen() and:
>>>print cmd
diff3 -m -E 'local\foo' 'original\foo' 'remote\foo'
>From the Windows console, this works:
diff3 -m -E fish.txt slapping.txt dance.txt
but this does not:
diff3 -m -E 'fish.txt' 'slapping.txt' 'dance.txt'
diff3: 'fish.txt': No such file or directory.
Here's the version of diff3 that I'm using (diff3 -v):
diff3 (GNU diffutils) 2.7.2 [This is the version distributed in 'Programming
Python']
Version 2.8.1 of diff3 doesn't seem to work at all (except to display a
version number.)
I did find a version which was included in the Msys 1.0 distribution, which
has a slightly different version identification:
diff3 GNU diffutils 2.7 [notice the lack of parentheses]
This version will accept single quotes around the file name arguments. AND
this version will permit the test_merge_diff3 test to run to completion.
One note: The diffe and the file msys-1.0.dll must be somewhere in the
Windows PATH.
With this change, I can now run all unit tests without a failure on Windows
XP.
Dave Harris
More information about the Zope3-dev
mailing list