def uninstall(packages=[]): """Uninstall packages. """ uninstalled = [] for package in packages: uninstalled.append((package, uninstall_package(package))) return uninstalled
def test_uninstall_error(self): filenames, import_mock = self.create_fake_import(name=FAKE_NAME1, uninstall_status=InstallationStatuses.UNINSTALL_ERROR) packages_count = FakePackage.select().count() with patch('procyon.pkg.logic.os.listdir', new=lambda ls: filenames): with patch('__builtin__.__import__', new=lambda *args: import_mock): status = uninstall_package(FAKE_NAME1) self.assertEqual(status, InstallationStatuses.UNINSTALL_ERROR) self.assertEqual(FakePackage.select().count(), packages_count)
def test_uninstall_ok(self): filenames, import_mock = self.create_fake_import(name=FAKE_NAME1) packages_count = FakePackage.select().count() with patch('procyon.pkg.logic.os.listdir', new=lambda ls: filenames): with patch('__builtin__.__import__', new=lambda *args: import_mock): status = uninstall_package(FAKE_NAME1) self.assertEqual(status, InstallationStatuses.UNINSTALL_OK) self.assertEqual(FakePackage.select().count(), packages_count - 1)