tests: Add tearDown method for cleanup
This commit is contained in:
@@ -19,20 +19,21 @@ class InstallDBTestCase(testcase.TestCase):
|
|||||||
testcase.TestCase.setUp(self)
|
testcase.TestCase.setUp(self)
|
||||||
self.installdb = pisi.db.installdb.InstallDB()
|
self.installdb = pisi.db.installdb.InstallDB()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pisi.api.remove(["ctorrent", "ethtool"])
|
||||||
|
|
||||||
def testGetPackage(self):
|
def testGetPackage(self):
|
||||||
pisi.api.install(["ethtool"])
|
pisi.api.install(["ethtool"])
|
||||||
idb = pisi.db.installdb.InstallDB()
|
idb = pisi.db.installdb.InstallDB()
|
||||||
pkg = idb.get_package("ethtool")
|
pkg = idb.get_package("ethtool")
|
||||||
assert type(pkg) == pisi.metadata.Package
|
assert type(pkg) == pisi.metadata.Package
|
||||||
assert pkg.name == "ethtool"
|
assert pkg.name == "ethtool"
|
||||||
pisi.api.remove(["ethtool"])
|
|
||||||
|
|
||||||
def testHasPackage(self):
|
def testHasPackage(self):
|
||||||
pisi.api.install(["ethtool"])
|
pisi.api.install(["ethtool"])
|
||||||
self.installdb = pisi.db.installdb.InstallDB()
|
self.installdb = pisi.db.installdb.InstallDB()
|
||||||
assert not self.installdb.has_package("hedehodo")
|
assert not self.installdb.has_package("hedehodo")
|
||||||
assert self.installdb.has_package("ethtool")
|
assert self.installdb.has_package("ethtool")
|
||||||
pisi.api.remove(["ethtool"])
|
|
||||||
|
|
||||||
def testListInstalled(self):
|
def testListInstalled(self):
|
||||||
pisi.api.install(["ethtool"])
|
pisi.api.install(["ethtool"])
|
||||||
@@ -41,7 +42,6 @@ class InstallDBTestCase(testcase.TestCase):
|
|||||||
'jpeg', 'libidn', 'db4',
|
'jpeg', 'libidn', 'db4',
|
||||||
'cracklib', 'openssl',
|
'cracklib', 'openssl',
|
||||||
'curl', 'bash', 'ethtool'])
|
'curl', 'bash', 'ethtool'])
|
||||||
pisi.api.remove(["ethtool"])
|
|
||||||
|
|
||||||
def testGetVersion(self):
|
def testGetVersion(self):
|
||||||
pisi.api.install(["ethtool"])
|
pisi.api.install(["ethtool"])
|
||||||
@@ -50,14 +50,12 @@ class InstallDBTestCase(testcase.TestCase):
|
|||||||
assert version == "0.3"
|
assert version == "0.3"
|
||||||
assert release == "1"
|
assert release == "1"
|
||||||
assert build == None
|
assert build == None
|
||||||
pisi.api.remove(["ethtool"])
|
|
||||||
|
|
||||||
def testGetFiles(self):
|
def testGetFiles(self):
|
||||||
pisi.api.install(["ethtool"])
|
pisi.api.install(["ethtool"])
|
||||||
self.installdb = pisi.db.installdb.InstallDB()
|
self.installdb = pisi.db.installdb.InstallDB()
|
||||||
files = self.installdb.get_files("ethtool")
|
files = self.installdb.get_files("ethtool")
|
||||||
assert files.list[0].path == "usr/bin/ethtool"
|
assert files.list[0].path == "usr/bin/ethtool"
|
||||||
pisi.api.remove(["ethtool"])
|
|
||||||
|
|
||||||
def testGetInfo(self):
|
def testGetInfo(self):
|
||||||
pisi.api.install(["ethtool"])
|
pisi.api.install(["ethtool"])
|
||||||
@@ -65,7 +63,6 @@ class InstallDBTestCase(testcase.TestCase):
|
|||||||
info = idb.get_info("ethtool")
|
info = idb.get_info("ethtool")
|
||||||
self.assertTrue(isinstance(info, pisi.db.installdb.InstallInfo))
|
self.assertTrue(isinstance(info, pisi.db.installdb.InstallInfo))
|
||||||
self.assertEqual(info.version, "0.3")
|
self.assertEqual(info.version, "0.3")
|
||||||
pisi.api.remove(["ethtool"])
|
|
||||||
|
|
||||||
def testGetReverseDependencies(self):
|
def testGetReverseDependencies(self):
|
||||||
pisi.api.install(["ethtool"])
|
pisi.api.install(["ethtool"])
|
||||||
@@ -73,8 +70,6 @@ class InstallDBTestCase(testcase.TestCase):
|
|||||||
self.installdb = pisi.db.installdb.InstallDB()
|
self.installdb = pisi.db.installdb.InstallDB()
|
||||||
revdeps = self.installdb.get_rev_deps("openssl")
|
revdeps = self.installdb.get_rev_deps("openssl")
|
||||||
assert set(["ctorrent", "curl"]) == set(map(lambda x:x[0], revdeps))
|
assert set(["ctorrent", "curl"]) == set(map(lambda x:x[0], revdeps))
|
||||||
pisi.api.remove(["ctorrent"])
|
|
||||||
pisi.api.remove(["ethtool"])
|
|
||||||
|
|
||||||
def testAddRemovePackage(self):
|
def testAddRemovePackage(self):
|
||||||
pisi.api.install(["ctorrent"])
|
pisi.api.install(["ctorrent"])
|
||||||
@@ -85,8 +80,6 @@ class InstallDBTestCase(testcase.TestCase):
|
|||||||
self.installdb = pisi.db.installdb.InstallDB()
|
self.installdb = pisi.db.installdb.InstallDB()
|
||||||
assert self.installdb.has_package("ctorrent")
|
assert self.installdb.has_package("ctorrent")
|
||||||
assert self.installdb.has_package("ethtool")
|
assert self.installdb.has_package("ethtool")
|
||||||
pisi.api.remove(["ctorrent"])
|
|
||||||
pisi.api.remove(["ethtool"])
|
|
||||||
|
|
||||||
def testMarkListPending(self):
|
def testMarkListPending(self):
|
||||||
pisi.api.set_comar(False)
|
pisi.api.set_comar(False)
|
||||||
@@ -109,12 +102,9 @@ class InstallDBTestCase(testcase.TestCase):
|
|||||||
pisi.api.set_comar(True)
|
pisi.api.set_comar(True)
|
||||||
|
|
||||||
def testSearchPackage(self):
|
def testSearchPackage(self):
|
||||||
pisi.api.set_comar(False)
|
|
||||||
self.installdb = pisi.db.installdb.InstallDB()
|
self.installdb = pisi.db.installdb.InstallDB()
|
||||||
assert not self.installdb.has_package("ethtool")
|
assert not self.installdb.has_package("ethtool")
|
||||||
assert not self.installdb.search_package(["ethtool"])
|
assert not self.installdb.search_package(["ethtool"])
|
||||||
pisi.api.install(["ethtool"])
|
pisi.api.install(["ethtool"])
|
||||||
self.installdb = pisi.db.installdb.InstallDB()
|
self.installdb = pisi.db.installdb.InstallDB()
|
||||||
assert self.installdb.search_package(["et", "tool", "h"]) == ["ethtool"]
|
assert self.installdb.search_package(["et", "tool", "h"]) == ["ethtool"]
|
||||||
pisi.api.remove(["ethtool"])
|
|
||||||
pisi.api.set_comar(True)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user