* testi gecmesi calistigi anlamina gelmez tabii ki
This commit is contained in:
@@ -139,3 +139,6 @@ class Archive:
|
|||||||
|
|
||||||
def unpack(self, targetDir):
|
def unpack(self, targetDir):
|
||||||
self.archive.unpack(targetDir)
|
self.archive.unpack(targetDir)
|
||||||
|
|
||||||
|
def unpack_file(self, targetDir):
|
||||||
|
self.archive.unpack(targetDir)
|
||||||
|
|||||||
+2
-2
@@ -37,7 +37,7 @@ def prefix(a, b):
|
|||||||
"check if sequence a is a prefix of sequence b"
|
"check if sequence a is a prefix of sequence b"
|
||||||
if len(a)>len(b):
|
if len(a)>len(b):
|
||||||
return False
|
return False
|
||||||
for i in [0:len(a)-1):
|
for i in range(0,len(a)-1):
|
||||||
if a[i]!=b[i]:
|
if a[i]!=b[i]:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@@ -55,7 +55,7 @@ def commonprefix(l):
|
|||||||
returns a list of path components"""
|
returns a list of path components"""
|
||||||
common = []
|
common = []
|
||||||
comps = map(os.path.split, l)
|
comps = map(os.path.split, l)
|
||||||
for i in [0:min(len,l)-1]:
|
for i in range(0, min(len,l)-1):
|
||||||
compi = map(lambda x: x[i], comps) # get ith slice
|
compi = map(lambda x: x[i], comps) # get ith slice
|
||||||
if same(compi):
|
if same(compi):
|
||||||
common.append(compi[0])
|
common.append(compi[0])
|
||||||
|
|||||||
@@ -64,6 +64,19 @@ class ArchiveFileTestCase(unittest.TestCase):
|
|||||||
testfile = targetDir + "/sandbox/deneme/hed"
|
testfile = targetDir + "/sandbox/deneme/hed"
|
||||||
assert islink(testfile)
|
assert islink(testfile)
|
||||||
|
|
||||||
|
def testUnpackZipCond(self):
|
||||||
|
ctx = context.Context("tests/sandbox/sandbox.pspec")
|
||||||
|
fetch = fetcher.Fetcher(ctx)
|
||||||
|
fetch.fetch()
|
||||||
|
targetDir = ctx.pkg_work_dir()
|
||||||
|
assert ctx.spec.source.archiveType == "zip"
|
||||||
|
fileName = os.path.basename(ctx.spec.source.archiveUri)
|
||||||
|
filePath = ctx.archives_dir() + '/' + fileName
|
||||||
|
achv = archive.Archive(filePath, ctx.spec.source.archiveType)
|
||||||
|
achv.unpack_file("sandbox/borek.cd")
|
||||||
|
assert pathexists(targetDir + "/sandbox")
|
||||||
|
testfile = targetDir + "/sandbox/borek.cs"
|
||||||
|
assert pathexists(testfile)
|
||||||
|
|
||||||
|
|
||||||
suite = unittest.makeSuite(ArchiveFileTestCase)
|
suite = unittest.makeSuite(ArchiveFileTestCase)
|
||||||
|
|||||||
Reference in New Issue
Block a user