zip dosyaları için unittest.
ARchiveZip şu anda fail ediyor.
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from os.path import exists as pathexists
|
from os.path import exists as pathexists
|
||||||
|
from os.path import basename
|
||||||
|
|
||||||
from pisi import archive
|
from pisi import archive
|
||||||
from pisi import specfile
|
from pisi import specfile
|
||||||
|
from pisi import fetcher
|
||||||
from pisi import util
|
from pisi import util
|
||||||
|
|
||||||
class ArchiveFileTestCase(unittest.TestCase):
|
class ArchiveFileTestCase(unittest.TestCase):
|
||||||
@@ -11,14 +13,14 @@ class ArchiveFileTestCase(unittest.TestCase):
|
|||||||
self.spec = specfile.SpecFile()
|
self.spec = specfile.SpecFile()
|
||||||
self.spec.read("samples/popt.pspec")
|
self.spec.read("samples/popt.pspec")
|
||||||
|
|
||||||
self.achv = archive.Archive(self.spec.source.archiveType,
|
|
||||||
self.spec.source.archiveName)
|
|
||||||
|
|
||||||
def testUnpackTar(self):
|
def testUnpackTar(self):
|
||||||
|
achv = archive.Archive(self.spec.source.archiveType,
|
||||||
|
self.spec.source.archiveName)
|
||||||
|
|
||||||
assert self.spec.source.archiveType == "targz"
|
assert self.spec.source.archiveType == "targz"
|
||||||
|
|
||||||
# unpacking is trivial with Archive()
|
# unpacking is trivial with Archive()
|
||||||
self.achv.unpack()
|
achv.unpack()
|
||||||
|
|
||||||
# but testing is hard
|
# but testing is hard
|
||||||
assert pathexists("popt-1.7")
|
assert pathexists("popt-1.7")
|
||||||
@@ -29,5 +31,16 @@ class ArchiveFileTestCase(unittest.TestCase):
|
|||||||
self.assertEqual(util.md5_file(testfile),
|
self.assertEqual(util.md5_file(testfile),
|
||||||
"171545adab7b51ebf6ec5575d3000a95")
|
"171545adab7b51ebf6ec5575d3000a95")
|
||||||
|
|
||||||
|
def testUnpackZip(self):
|
||||||
|
# first, we need to fetch a zip file
|
||||||
|
uri = "http://cekirdek.uludag.org.tr/~meren/sandbox.zip"
|
||||||
|
filename = basename(uri)
|
||||||
|
fetch = fetcher.Fetcher(uri, filename)
|
||||||
|
fetch.fetch()
|
||||||
|
|
||||||
|
achv = archive.Archive("zip", filename)
|
||||||
|
achv.unpack()
|
||||||
|
|
||||||
|
|
||||||
suite = unittest.makeSuite(ArchiveFileTestCase)
|
suite = unittest.makeSuite(ArchiveFileTestCase)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user