Преглед изворни кода

Add test for wheels with files in data/lib/site-packages

Thomas Kluyver пре 6 година
родитељ
комит
58695bb2c0
1 измењених фајлова са 16 додато и 0 уклоњено
  1. 16 0
      nsist/tests/test_local_wheels.py

+ 16 - 0
nsist/tests/test_local_wheels.py

@@ -99,3 +99,19 @@ def test_extract_exclude_folder(tmpdir):
 
     assert_isfile(str(pkgs / 'foo' / 'bar.txt'))
     assert_not_path_exists(str(pkgs / 'foo' / 'bar'))
+
+def test_extract_data_lib_sitepkg(tmpdir):
+    whl_file = str(tmpdir / 'foo.whl')
+    pkgs = tmpdir.mkdir('pkgs')
+
+    with ZipFile(whl_file, 'w') as zf:
+        zf.writestr('osgeo/bar.txt', b'blah')
+        # The case of 'Lib/site-packages' shouldn't matter
+        zf.writestr('foo-1.0.data/data/Lib/siTE-packages/osgeo/abc.txt', b'a')
+        zf.writestr('foo-1.0.data/data/lib/site-packages/osgeo/def.txt', b'd')
+
+    extract_wheel(whl_file, str(pkgs), exclude=['pkgs/foo/bar'])
+
+    assert_isfile(str(pkgs / 'osgeo' / 'bar.txt'))
+    assert_isfile(str(pkgs / 'osgeo' / 'abc.txt'))
+    assert_isfile(str(pkgs / 'osgeo' / 'def.txt'))