def test_removeAllScheduledPackages():
    manager = PackageManager(MagicMock())
    manager._purgePackage = MagicMock()

    manager._to_remove_package_set = {"beep"}
    manager._installed_package_dict = {"beep": {}}
    manager._removeAllScheduledPackages()
    assert manager._to_remove_package_set == set()
def test_removeAllScheduledPackagesWithException():
    manager = PackageManager(MagicMock())
    manager._purgePackage = MagicMock(side_effect=Exception)
    manager._installed_package_dict = {"beep": {}}
    manager._to_remove_package_set = {"beep"}

    manager._removeAllScheduledPackages()
    assert manager._to_remove_package_set == {"beep"}
    def test_newerVersionIsInstalled(self):
        manager = PackageManager(MagicMock())
        manager.addAvailablePackageVersion("beep", Version("1.0.0"))
        manager._installed_package_dict = {
            "beep": {
                "package_info": {
                    "package_version": "1.9.1"
                }
            }
        }

        assert manager.checkIfPackageCanUpdate("beep") is False