summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2019-04-21 10:59:28 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2019-04-21 11:22:11 +0200
commitc2d8dab8250d3cc6969fcabfd9f606ffe9c63823 (patch)
treed70b5fd4a892ddb773c81fa9e9473d084b29decd /tests
parent7c2781c44a06b7e695dd225a106359208793c271 (diff)
downloadgobject-introspection-c2d8dab8250d3cc6969fcabfd9f606ffe9c63823.tar.gz
scanner: Fix error on Windows in case source files are on different drives
os.path.commonpath() raises ValueError if the paths given to it are on different drives. Handle that case by giving up and add a test. Reported here: https://github.com/msys2/MINGW-packages/pull/5258#issuecomment-485230864
Diffstat (limited to 'tests')
-rw-r--r--tests/scanner/test_scanner.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/scanner/test_scanner.py b/tests/scanner/test_scanner.py
index 2513c0de..85953964 100644
--- a/tests/scanner/test_scanner.py
+++ b/tests/scanner/test_scanner.py
@@ -25,6 +25,16 @@ class TestScanner(unittest.TestCase):
paths = get_source_root_dirs(options, [])
self.assertEqual(paths, [])
+ @unittest.skipUnless(os.name == "nt", "Windows only")
+ def test_get_source_root_dirs_different_drives(self):
+ options = optparse.Values({"sources_top_dirs": []})
+ names = [
+ os.path.join("X:", os.sep, "foo"),
+ os.path.join("Y:", os.sep, "bar"),
+ ]
+ paths = get_source_root_dirs(options, names)
+ self.assertEqual(paths, list(map(os.path.dirname, names)))
+
if __name__ == '__main__':
unittest.main()