Kaydet (Commit) f70e0760 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Only apply case-insensitivity test on appropriate platforms.' test_filecmp.py

üst eeca37e0
......@@ -46,10 +46,11 @@ class DirCompareTestCase(unittest.TestCase):
self.dir = os.path.join(tmpdir, 'dir')
self.dir_same = os.path.join(tmpdir, 'dir-same')
self.dir_diff = os.path.join(tmpdir, 'dir-diff')
self.caseinsensitive = os.path.normcase('A') == os.path.normcase('a')
data = 'Contents of file go here.\n'
for dir in [self.dir, self.dir_same, self.dir_diff]:
os.mkdir(dir)
if dir is self.dir_same:
if self.caseinsensitive and dir is self.dir_same:
fn = 'FiLe' # Verify case-insensitive comparison
else:
fn = 'file'
......@@ -97,7 +98,10 @@ class DirCompareTestCase(unittest.TestCase):
def test_dircmp(self):
# Check attributes for comparison of two identical directories
d = filecmp.dircmp(self.dir, self.dir_same)
self.assertEqual([d.left_list, d.right_list],[['file'], ['FiLe']])
if self.caseinsensitive:
self.assertEqual([d.left_list, d.right_list],[['file'], ['FiLe']])
else:
self.assertEqual([d.left_list, d.right_list],[['file'], ['file']])
self.failUnless(d.common == ['file'])
self.failUnless(d.left_only == d.right_only == [])
self.failUnless(d.same_files == ['file'])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment