[gobject-introspection/msvc.fixes: 3/3] test_scanner.py: Fix path tests on Windows



commit 114eb227c53ab8555d245fee296349c5dd0de68d
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Jan 15 15:47:08 2020 +0800

    test_scanner.py: Fix path tests on Windows
    
    We may get drive letters and paths either in upper or lower cases
    in Windows, which are actually no different.   Ignore the cases
    in this case.

 tests/scanner/test_scanner.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/tests/scanner/test_scanner.py b/tests/scanner/test_scanner.py
index 85953964..6f30d890 100644
--- a/tests/scanner/test_scanner.py
+++ b/tests/scanner/test_scanner.py
@@ -12,7 +12,11 @@ class TestScanner(unittest.TestCase):
         paths = get_source_root_dirs(options, ["nope"])
         self.assertEqual(len(paths), 1)
         self.assertTrue(os.path.isabs(paths[0]))
-        self.assertEqual(paths[0], os.path.join(os.getcwd(), "foo"))
+        if os.name == 'nt':
+            self.assertEqual(paths[0].casefold(),
+                             os.path.join(os.getcwd(), "foo").casefold())
+        else:
+            self.assertEqual(paths[0], os.path.join(os.getcwd(), "foo"))
 
     def test_get_source_root_dirs_guess(self):
         options = optparse.Values({"sources_top_dirs": []})
@@ -20,7 +24,10 @@ class TestScanner(unittest.TestCase):
         paths = get_source_root_dirs(
             options, [os.path.join(cwd, "foo"), os.path.join(cwd, "bar")])
         self.assertEqual(len(paths), 1)
-        self.assertEqual(paths[0], cwd)
+        if os.name == 'nt':
+            self.assertEqual(paths[0].casefold(), cwd.casefold())
+        else:
+            self.assertEqual(paths[0], cwd)
 
         paths = get_source_root_dirs(options, [])
         self.assertEqual(paths, [])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]