Jelajahi Sumber

Test extracting files from a wheel

Thomas Kluyver 9 tahun lalu
induk
melakukan
9dbdb3f200
1 mengubah file dengan 8 tambahan dan 2 penghapusan
  1. 8 2
      nsist/tests/test_pypi.py

+ 8 - 2
nsist/tests/test_pypi.py

@@ -1,13 +1,19 @@
 from nose.tools import *
 from nose.tools import *
-from testpath import assert_isfile
+from os.path import join as pjoin
+from testpath import assert_isfile, assert_isdir
+from testpath.tempdir import TemporaryDirectory
 
 
-from nsist.pypi import WheelDownloader, CachedRelease
+from nsist.pypi import WheelDownloader, extract_wheel, CachedRelease
 
 
 def test_download():
 def test_download():
     wd = WheelDownloader("astsearch==0.1.2", "3.5.1", 64)
     wd = WheelDownloader("astsearch==0.1.2", "3.5.1", 64)
     wheel = wd.fetch()
     wheel = wd.fetch()
     assert_isfile(wheel)
     assert_isfile(wheel)
 
 
+    with TemporaryDirectory() as td:
+        extract_wheel(wheel, target_dir=td)
+        assert_isfile(pjoin(td, 'astsearch.py'))
+
 # To exclude this, run:  nosetests -a '!network'
 # To exclude this, run:  nosetests -a '!network'
 test_download.network = 1
 test_download.network = 1