fix tests, now we pass them all

This commit is contained in:
Eray Özkural
2005-11-06 13:58:49 +00:00
parent cc4269bb27
commit eec72f69f8
4 changed files with 14 additions and 13 deletions
+1
View File
@@ -511,6 +511,7 @@ def is_package_name(fn, package_name = None):
def env_update(): def env_update():
ctx.ui.info(_('Updating environment...'))
env_dir = join_path(ctx.config.dest_dir(), "/etc/env.d") env_dir = join_path(ctx.config.dest_dir(), "/etc/env.d")
profile_file = join_path(ctx.config.dest_dir(), "/etc/profile.env") profile_file = join_path(ctx.config.dest_dir(), "/etc/profile.env")
ldconf_file = join_path(ctx.config.dest_dir(), "/etc/ld.so.conf") ldconf_file = join_path(ctx.config.dest_dir(), "/etc/ld.so.conf")
+9 -9
View File
@@ -31,7 +31,7 @@ class ArchiveFileTestCase(testcase.TestCase):
achv = sourcearchive.SourceArchive(bctx) achv = sourcearchive.SourceArchive(bctx)
assert bctx.spec.source.archiveType == "targz" assert bctx.spec.source.archive.type == "targz"
# skip fetching and directly unpack the previously fetched (by # skip fetching and directly unpack the previously fetched (by
# fetchertests) archive # fetchertests) archive
@@ -54,11 +54,11 @@ class ArchiveFileTestCase(testcase.TestCase):
def testUnpackZip(self): def testUnpackZip(self):
bctx = BuildContext("tests/pccts/pspec.xml") bctx = BuildContext("tests/pccts/pspec.xml")
assert bctx.spec.source.archiveType == "zip" assert bctx.spec.source.archive.type == "zip"
achv = sourcearchive.SourceArchive(bctx) achv = sourcearchive.SourceArchive(bctx)
achv.fetch(interactive=False) achv.fetch(interactive=False)
achv.unpack(cleanDir=True) achv.unpack(clean_dir=True)
targetDir = bctx.pkg_work_dir() targetDir = bctx.pkg_work_dir()
assert pathexists(targetDir + "/pccts") assert pathexists(targetDir + "/pccts")
@@ -82,7 +82,7 @@ class ArchiveFileTestCase(testcase.TestCase):
targetDir = bctx.pkg_work_dir() targetDir = bctx.pkg_work_dir()
achv = sourcearchive.SourceArchive(bctx) achv = sourcearchive.SourceArchive(bctx)
achv.fetch(interactive=False) achv.fetch(interactive=False)
achv.unpack(cleanDir=True) achv.unpack(clean_dir=True)
del achv del achv
newZip = targetDir + "/new.zip" newZip = targetDir + "/new.zip"
@@ -95,17 +95,17 @@ class ArchiveFileTestCase(testcase.TestCase):
def testUnpackZipCond(self): def testUnpackZipCond(self):
bctx = BuildContext("tests/pccts/pspec.xml") bctx = BuildContext("tests/pccts/pspec.xml")
url = uri.URI(bctx.spec.source.archiveUri) url = uri.URI(bctx.spec.source.archive.uri)
targetDir = bctx.pkg_work_dir() targetDir = bctx.pkg_work_dir()
filePath = join(ctx.config.archives_dir(), url.filename()) filePath = join(ctx.config.archives_dir(), url.filename())
# check cached # check cached
if util.sha1_file(filePath) != bctx.spec.source.archiveSHA1: if util.sha1_file(filePath) != bctx.spec.source.archive.sha1sum:
fetch = fetcher.Fetcher(bctx.spec.source.archiveUri, targetDir) fetch = fetcher.Fetcher(bctx.spec.source.archive.uri, targetDir)
fetch.fetch() fetch.fetch()
assert bctx.spec.source.archiveType == "zip" assert bctx.spec.source.archive.type == "zip"
achv = archive.Archive(filePath, bctx.spec.source.archiveType) achv = archive.Archive(filePath, bctx.spec.source.archive.type)
achv.unpack_files(["pccts/history.txt"], targetDir) achv.unpack_files(["pccts/history.txt"], targetDir)
assert pathexists(targetDir + "/pccts") assert pathexists(targetDir + "/pccts")
testfile = targetDir + "/pccts/history.txt" testfile = targetDir + "/pccts/history.txt"
+1 -1
View File
@@ -20,7 +20,7 @@ class DependencyTestCase(unittest.TestCase):
def testDep(self): def testDep(self):
# a real life story bug #603 # a real life story bug #603
gtkmmdep = DepInfo() gtkmmdep = Dependency()
gtkmmdep.versionFrom = '1.9.1' gtkmmdep.versionFrom = '1.9.1'
gtkmmdep.package = 'atk' gtkmmdep.package = 'atk'
self.assert_( not gtkmmdep.satisfies('atk', '1.8.0', 1) ) self.assert_( not gtkmmdep.satisfies('atk', '1.8.0', 1) )
+3 -3
View File
@@ -26,7 +26,7 @@ class FetcherTestCase(testcase.TestCase):
self.spec = SpecFile() self.spec = SpecFile()
self.spec.read("tests/helloworld/pspec.xml") self.spec.read("tests/helloworld/pspec.xml")
self.url = uri.URI(self.spec.source.archiveUri) self.url = uri.URI(self.spec.source.archive.uri)
self.destpath = ctx.config.archives_dir() self.destpath = ctx.config.archives_dir()
self.fetch = fetcher.Fetcher(self.url, self.destpath) self.fetch = fetcher.Fetcher(self.url, self.destpath)
@@ -35,7 +35,7 @@ class FetcherTestCase(testcase.TestCase):
fetchedFile = os.path.join(self.destpath, self.url.filename()) fetchedFile = os.path.join(self.destpath, self.url.filename())
if os.access(fetchedFile, os.R_OK): if os.access(fetchedFile, os.R_OK):
self.assertEqual(util.sha1_file(fetchedFile), self.assertEqual(util.sha1_file(fetchedFile),
self.spec.source.archiveSHA1) self.spec.source.archive.sha1sum)
os.remove(fetchedFile) os.remove(fetchedFile)
def testResume(self): def testResume(self):
@@ -45,7 +45,7 @@ class FetcherTestCase(testcase.TestCase):
fetchedFile = os.path.join(self.destpath, self.url.filename()) fetchedFile = os.path.join(self.destpath, self.url.filename())
if os.access(fetchedFile, os.R_OK): if os.access(fetchedFile, os.R_OK):
self.assertEqual(util.sha1_file(fetchedFile), self.assertEqual(util.sha1_file(fetchedFile),
self.spec.source.archiveSHA1) self.spec.source.archive.sha1sum)
os.remove(fetchedFile) os.remove(fetchedFile)
suite = unittest.makeSuite(FetcherTestCase) suite = unittest.makeSuite(FetcherTestCase)