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

This commit is contained in:
Raymond Hettinger 2003-09-02 06:59:21 +00:00
parent eeca37e0b5
commit f70e076042
1 changed files with 6 additions and 2 deletions

View File

@ -46,10 +46,11 @@ def setUp(self):
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 @@ def test_cmpfiles(self):
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'])