implement packagetests
This commit is contained in:
@@ -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
@@ -23,6 +23,7 @@ def run_all():
|
|||||||
import graphtests
|
import graphtests
|
||||||
import versiontests
|
import versiontests
|
||||||
import configfiletests
|
import configfiletests
|
||||||
|
import packagetests
|
||||||
|
|
||||||
alltests = unittest.TestSuite((
|
alltests = unittest.TestSuite((
|
||||||
utiltests.suite,
|
utiltests.suite,
|
||||||
@@ -38,7 +39,8 @@ def run_all():
|
|||||||
actionsapitests.suite,
|
actionsapitests.suite,
|
||||||
graphtests.suite,
|
graphtests.suite,
|
||||||
versiontests.suite,
|
versiontests.suite,
|
||||||
configfiletests.suite
|
configfiletests.suite,
|
||||||
|
packagetests.suite
|
||||||
))
|
))
|
||||||
|
|
||||||
runTestSuite(alltests)
|
runTestSuite(alltests)
|
||||||
|
|||||||
Reference in New Issue
Block a user