From 92badfd36a80c9fb3a3e48f9a218b6f50c377adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Thu, 15 Jul 2010 13:57:39 +0000 Subject: [PATCH] tests: Add tearDown method for cleanup --- tests/database/installdbtest.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tests/database/installdbtest.py b/tests/database/installdbtest.py index 9414bbf4..3c8de5d6 100644 --- a/tests/database/installdbtest.py +++ b/tests/database/installdbtest.py @@ -19,20 +19,21 @@ class InstallDBTestCase(testcase.TestCase): testcase.TestCase.setUp(self) self.installdb = pisi.db.installdb.InstallDB() + def tearDown(self): + pisi.api.remove(["ctorrent", "ethtool"]) + def testGetPackage(self): pisi.api.install(["ethtool"]) idb = pisi.db.installdb.InstallDB() pkg = idb.get_package("ethtool") assert type(pkg) == pisi.metadata.Package assert pkg.name == "ethtool" - pisi.api.remove(["ethtool"]) def testHasPackage(self): pisi.api.install(["ethtool"]) self.installdb = pisi.db.installdb.InstallDB() assert not self.installdb.has_package("hedehodo") assert self.installdb.has_package("ethtool") - pisi.api.remove(["ethtool"]) def testListInstalled(self): pisi.api.install(["ethtool"]) @@ -41,7 +42,6 @@ class InstallDBTestCase(testcase.TestCase): 'jpeg', 'libidn', 'db4', 'cracklib', 'openssl', 'curl', 'bash', 'ethtool']) - pisi.api.remove(["ethtool"]) def testGetVersion(self): pisi.api.install(["ethtool"]) @@ -50,14 +50,12 @@ class InstallDBTestCase(testcase.TestCase): assert version == "0.3" assert release == "1" assert build == None - pisi.api.remove(["ethtool"]) def testGetFiles(self): pisi.api.install(["ethtool"]) self.installdb = pisi.db.installdb.InstallDB() files = self.installdb.get_files("ethtool") assert files.list[0].path == "usr/bin/ethtool" - pisi.api.remove(["ethtool"]) def testGetInfo(self): pisi.api.install(["ethtool"]) @@ -65,7 +63,6 @@ class InstallDBTestCase(testcase.TestCase): info = idb.get_info("ethtool") self.assertTrue(isinstance(info, pisi.db.installdb.InstallInfo)) self.assertEqual(info.version, "0.3") - pisi.api.remove(["ethtool"]) def testGetReverseDependencies(self): pisi.api.install(["ethtool"]) @@ -73,8 +70,6 @@ class InstallDBTestCase(testcase.TestCase): self.installdb = pisi.db.installdb.InstallDB() revdeps = self.installdb.get_rev_deps("openssl") assert set(["ctorrent", "curl"]) == set(map(lambda x:x[0], revdeps)) - pisi.api.remove(["ctorrent"]) - pisi.api.remove(["ethtool"]) def testAddRemovePackage(self): pisi.api.install(["ctorrent"]) @@ -85,8 +80,6 @@ class InstallDBTestCase(testcase.TestCase): self.installdb = pisi.db.installdb.InstallDB() assert self.installdb.has_package("ctorrent") assert self.installdb.has_package("ethtool") - pisi.api.remove(["ctorrent"]) - pisi.api.remove(["ethtool"]) def testMarkListPending(self): pisi.api.set_comar(False) @@ -109,12 +102,9 @@ class InstallDBTestCase(testcase.TestCase): pisi.api.set_comar(True) def testSearchPackage(self): - pisi.api.set_comar(False) self.installdb = pisi.db.installdb.InstallDB() assert not self.installdb.has_package("ethtool") assert not self.installdb.search_package(["ethtool"]) pisi.api.install(["ethtool"]) self.installdb = pisi.db.installdb.InstallDB() assert self.installdb.search_package(["et", "tool", "h"]) == ["ethtool"] - pisi.api.remove(["ethtool"]) - pisi.api.set_comar(True)