From 20ff302e89fa8b1ab5d7bf4d93ebf0f131c96e3d Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 30 Oct 2024 23:50:06 +0100 Subject: [PATCH] checkupdates: remove duplicate push in push_commits() --- fdroidserver/checkupdates.py | 3 --- tests/test_checkupdates.py | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 60b696a9..75a59ba1 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -739,9 +739,6 @@ def push_commits(remote_name='origin', branch_name='checkupdates', verbose=False git_repo.create_head(branch_name, force=True) remote = git_repo.remotes[remote_name] - pushinfos = remote.push( - branch_name, force=True, set_upstream=True, progress=progress - ) pushinfos = remote.push( branch_name, progress=progress, diff --git a/tests/test_checkupdates.py b/tests/test_checkupdates.py index 8225cdff..c99d31bf 100755 --- a/tests/test_checkupdates.py +++ b/tests/test_checkupdates.py @@ -464,10 +464,13 @@ class CheckupdatesTest(unittest.TestCase): self.assertTrue(branch in ('main', 'master')) self.assertTrue(branch in repo.heads) + @mock.patch('git.remote.Remote.push') @mock.patch('sys.exit') @mock.patch('fdroidserver.common.read_app_args') @mock.patch('fdroidserver.checkupdates.checkupdates_app') - def test_merge_requests_branch(self, checkupdates_app, read_app_args, sys_exit): + def test_merge_requests_branch( + self, checkupdates_app, read_app_args, sys_exit, push + ): def _sys_exit(return_code=0): self.assertEqual(return_code, 0) @@ -499,5 +502,6 @@ class CheckupdatesTest(unittest.TestCase): self.assertNotIn(appid, git_repo.heads) with mock.patch('sys.argv', ['fdroid checkupdates', '--merge-request', appid]): fdroidserver.checkupdates.main() + push.assert_called_once() sys_exit.assert_called_once() self.assertIn(appid, git_repo.heads)