From cd50222009d5b4e4290bd22b6ad058bccfd76724 Mon Sep 17 00:00:00 2001 From: David Gnedt Date: Sat, 31 Jul 2021 01:36:00 +0200 Subject: [PATCH] Fix caching unit tests to not assume a specific directory separator --- test/test_caching.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/test_caching.py b/test/test_caching.py index 628e00a..cc6de36 100644 --- a/test/test_caching.py +++ b/test/test_caching.py @@ -132,31 +132,31 @@ def test_rename(self): class RelPathKeyTest(RelTestCase): def test_nocase_findfile(self): cache = FileInfoCache() - a1 = self.mkfile('aAaA/AaA1', '1') - self.mkfile('aAaA/Aaa2', '2') - self.mkfile('aAaA/AAa2', '3') + a1 = self.mkfile(os.path.join('aAaA', 'AaA1'), '1') + self.mkfile(os.path.join('aAaA', 'Aaa2'), '2') + self.mkfile(os.path.join('aAaA', 'AAa2'), '3') - self.assertEquals(a1, cache.nocase_findfile(self.mkpath('aaAA/aaa1'))) + self.assertEquals(a1, cache.nocase_findfile(self.mkpath(os.path.join('aaAA', 'aaa1')))) with self.assertRaises(IOError) as cm: - cache.nocase_findfile(self.mkpath('aaAb/aaa1')) + cache.nocase_findfile(self.mkpath(os.path.join('aaAb', 'aaa1'))) self.assertEquals(errno.ENOENT, cm.exception.errno) with self.assertRaises(IOError) as cm: - cache.nocase_findfile(self.mkpath('aaAA/aab1')) + cache.nocase_findfile(self.mkpath(os.path.join('aaAA', 'aab1'))) self.assertEquals(errno.ENOENT, cm.exception.errno) with self.assertRaises(IOError) as cm: - cache.nocase_findfile(self.mkpath('aaAA/aaa2')) + cache.nocase_findfile(self.mkpath(os.path.join('aaAA', 'aaa2'))) self.assertEquals(errno.EEXIST, cm.exception.errno) def test_nocase_findfile_parent(self): cache = FileInfoCache() - self.mkfile('aaaA/aaA1', '1') - self.mkfile('aAaA/aaa2', '2') + self.mkfile(os.path.join('aaaA', 'aaA1'), '1') + self.mkfile(os.path.join('aAaA', 'aaa2'), '2') # right now we don't handle this case, though it would be possible # to generate all possible matches and see if the number is exactly # one. with self.assertRaises(IOError) as cm: - cache.nocase_findfile(self.mkpath('aaAA/aaa2')) + cache.nocase_findfile(self.mkpath(os.path.join('aaAA', 'aaa2'))) self.assertEquals(errno.EEXIST, cm.exception.errno)