diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-06-23 22:08:19 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-06-23 22:08:19 -0400 |
commit | 4f5c542411028be233c6c0e35ef23496a5b47282 (patch) | |
tree | a73890333e7993561cb0e78849c379c3fb592518 /test/test_farm.py | |
parent | ef82923610fddc367490e4287ee353d14b5fcaae (diff) | |
download | python-coveragepy-git-4f5c542411028be233c6c0e35ef23496a5b47282.tar.gz |
Comparing files needs to be agnostic to line endings, or testing on Linux won't work. Now gold files are newline-only, and the comparison function ignores line endings.
Diffstat (limited to 'test/test_farm.py')
-rw-r--r-- | test/test_farm.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/test_farm.py b/test/test_farm.py index 9ca494fe..d33dcdca 100644 --- a/test/test_farm.py +++ b/test/test_farm.py @@ -223,7 +223,16 @@ class FarmTestCase(object): wrong_size.append(f) assert not wrong_size, "File sizes differ: %s" % wrong_size else: - assert not diff_files, "Files differ: %s" % diff_files + # filecmp only compares in binary mode, but we want text mode. So + # look through the list of different files, and compare them + # ourselves. + text_diff = [] + for f in diff_files: + left = open(os.path.join(dir1, f), "r").read() + right = open(os.path.join(dir2, f), "r").read() + if left != right: + text_diff.append(f) + assert not text_diff, "Files differ: %s" % text_diff if not left_extra: assert not left_only, "Files in %s only: %s" % (dir1, left_only) |