From e4586eeb7293f86bbbebcc3c2c33ff373e7c8f94 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Mon, 7 Apr 2025 21:02:52 -0400 Subject: [PATCH] upgrades: Cleanup use of return value from _apt_run _apt_run does not return anything. Signed-off-by: James Valleroy [sunil: Update test case] Signed-off-by: Sunil Mohan Adapa Tested-by: Sunil Mohan Adapa --- plinth/modules/upgrades/distupgrade.py | 6 +----- plinth/modules/upgrades/tests/test_distupgrade.py | 4 ---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/plinth/modules/upgrades/distupgrade.py b/plinth/modules/upgrades/distupgrade.py index 01b278254..f60658ba6 100644 --- a/plinth/modules/upgrades/distupgrade.py +++ b/plinth/modules/upgrades/distupgrade.py @@ -338,11 +338,7 @@ def _apt_autoremove(): def _apt_full_upgrade(): """Run and check if apt upgrade was successful.""" logger.info('Running apt full-upgrade...') - returncode = _apt_run(['full-upgrade']) - if returncode: - raise RuntimeError( - 'Apt full-upgrade was not successful. Distribution upgrade ' - 'will be retried at a later time.') + _apt_run(['full-upgrade']) def _unattended_upgrades_run(): diff --git a/plinth/modules/upgrades/tests/test_distupgrade.py b/plinth/modules/upgrades/tests/test_distupgrade.py index 4a5314ed9..bfd07b87c 100644 --- a/plinth/modules/upgrades/tests/test_distupgrade.py +++ b/plinth/modules/upgrades/tests/test_distupgrade.py @@ -396,10 +396,6 @@ def test_apt_full_upgrade(apt_run): distupgrade._apt_full_upgrade() apt_run.assert_called_with(['full-upgrade']) - apt_run.return_value = 1 - with pytest.raises(RuntimeError): - distupgrade._apt_full_upgrade() - @patch('subprocess.run') def test_unatteneded_upgrades_run(run):