def test_force_on_patch_queue_branch(self, testpkg, monkeypatch): # set current_branch() to a patch-queue branch: git('checkout', 'patch-queue/ceph-2-ubuntu') recorder = CallRecorder() monkeypatch.setattr('subprocess.check_call', recorder) mergep = MergePatches([]) mergep._run(force=True) # Verify that we run the "git reset" command here. expected = ['git', 'reset', '--hard', 'patches/ceph-2-rhel-patches'] assert recorder.args == expected
def test_force_on_patch_queue_branch(self, testpkg, monkeypatch): # set current_branch() to a patch-queue branch: git('checkout', 'patch-queue/ceph-2-ubuntu') recorder = CallRecorder() monkeypatch.setattr('subprocess.check_call', recorder) localbuild = MergePatches([]) localbuild._run(force=True) # Verify that we run the "git reset" command here. expected = ['git', 'reset', '--hard', 'patches/ceph-2-rhel-patches'] assert recorder.args == expected
def test_on_patch_queue_branch(self, testpkg, monkeypatch): # set our current branch to be a patch-queue branch: git('checkout', 'patch-queue/ceph-2-ubuntu') recorder = CallRecorder() monkeypatch.setattr('subprocess.check_call', recorder) mergep = MergePatches([]) mergep._run() # Verify that we run the "git merge" command here. expected = ['git', 'pull', '--ff-only', 'patches/ceph-2-rhel-patches'] assert recorder.args == expected
def test_on_patch_queue_branch(self, testpkg, monkeypatch): # set our current branch to be a patch-queue branch: git('checkout', 'patch-queue/ceph-2-ubuntu') recorder = CallRecorder() monkeypatch.setattr('subprocess.check_call', recorder) localbuild = MergePatches([]) localbuild._run() # Verify that we run the "git merge" command here. expected = ['git', 'pull', '--ff-only', 'patches/ceph-2-rhel-patches'] assert recorder.args == expected
def test_merge_patch_on_patch_queue_branch(self, monkeypatch): monkeypatch.setenv('HOME', FIXTURES_DIR) monkeypatch.setattr('subprocess.check_call', self.fake_check_call) # set current_branch() to a patch-queue branch: monkeypatch.setattr('rhcephpkg.util.current_branch', lambda: 'patch-queue/ceph-2-ubuntu') localbuild = MergePatches(()) localbuild._run() # Verify that we run the "git merge" command here. expected = ['git', 'pull', '--ff-only', 'patches/ceph-2-rhel-patches'] assert self.last_cmd == expected
def test_force_on_debian_branch(self, testpkg, monkeypatch): # set current_branch() to a debian branch: git('checkout', 'ceph-2-ubuntu') recorder = CallRecorder() monkeypatch.setattr('subprocess.check_call', recorder) localbuild = MergePatches([]) localbuild._run(force=True) # Verify that we run the "git push" command here. expected = [ 'git', 'push', '.', '+patches/ceph-2-rhel-patches:patch-queue/ceph-2-ubuntu' ] assert recorder.args == expected
def test_get_rhel_patches_branch(self, debian_branch, expected): m = MergePatches([]) assert m.get_rhel_patches_branch(debian_branch) == expected
def test_help(self, capsys): mergep = MergePatches(['rhcephpkg', 'merge-patches', '--help']) with pytest.raises(SystemExit): mergep.main() out, _ = capsys.readouterr() assert "Fetch the latest patches branch that rdopkg uses" in out