implement packagetests

This commit is contained in:
Barış Metin
2005-07-29 16:29:19 +00:00
parent c88a544542
commit 5fd3e32f08
2 changed files with 43 additions and 1 deletions
+40
View File
@@ -0,0 +1,40 @@
import unittest
import os
from pisi import util
from pisi.config import config
from pisi import package
class PackageTestCase(unittest.TestCase):
def setUp(self):
self.pkgName = util.package_name("testing",
"5.1",
"2")
def testAddExtract(self):
cur = os.getcwd()
tmpdir = config.tmp_dir()
sandboxdir = os.path.join(cur, "tests/sandbox")
pkg_path = os.path.join(tmpdir, self.pkgName)
pkg = package.Package(pkg_path, "w")
os.chdir(sandboxdir)
pkg.add_to_package("files.xml")
pkg.add_to_package("metadata.xml")
os.chdir(cur)
pkg.close()
pkg = package.Package(pkg_path)
pkg.extract_file("files.xml", cur)
if not os.path.exists("files.xml"):
self.fail("Package extract error")
os.remove("files.xml")
os.remove(pkg_path)
suite = unittest.makeSuite(PackageTestCase)
+3 -1
View File
@@ -23,6 +23,7 @@ def run_all():
import graphtests
import versiontests
import configfiletests
import packagetests
alltests = unittest.TestSuite((
utiltests.suite,
@@ -38,7 +39,8 @@ def run_all():
actionsapitests.suite,
graphtests.suite,
versiontests.suite,
configfiletests.suite
configfiletests.suite,
packagetests.suite
))
runTestSuite(alltests)