Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cherry_picker/cherry_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,9 @@ def abort_cherry_pick(self):
run `git cherry-pick --abort` and then clean up the branch
"""
if self.initial_state != WORKFLOW_STATES.BACKPORT_PAUSED:
raise ValueError("One can only abort a paused process.")
raise ValueError(
f"One can only abort a paused process. Current state: {self.initial_state}. Expected state: {WORKFLOW_STATES.BACKPORT_PAUSED}"
)

try:
validate_sha("CHERRY_PICK_HEAD")
Expand Down
5 changes: 3 additions & 2 deletions cherry_picker/test_cherry_picker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import pathlib
import re
import subprocess
import warnings
from collections import ChainMap
Expand Down Expand Up @@ -1141,7 +1142,7 @@ def test_continue_cherry_pick_invalid_state(tmp_git_repo_dir):

assert get_state() == WORKFLOW_STATES.UNSET

with pytest.raises(ValueError, match=r"^One can only continue a paused process.$"):
with pytest.raises(ValueError, match=re.compile(r"^One can only continue a paused process.")):
cherry_picker.continue_cherry_pick()

assert get_state() == WORKFLOW_STATES.UNSET # success
Expand All @@ -1167,7 +1168,7 @@ def test_abort_cherry_pick_invalid_state(tmp_git_repo_dir):

assert get_state() == WORKFLOW_STATES.UNSET

with pytest.raises(ValueError, match=r"^One can only abort a paused process.$"):
with pytest.raises(ValueError, match=re.compile(r"^One can only abort a paused process.")):
cherry_picker.abort_cherry_pick()


Expand Down