1515from aioresponses import aioresponses
1616
1717from kernel_patches_daemon .branch_worker import NewPRWithNoChangeException
18- from kernel_patches_daemon .config import KPDConfig
19- from kernel_patches_daemon .github_sync import GithubSync , HEAD_BASE_SEPARATOR
18+ from kernel_patches_daemon .config import KPDConfig , SERIES_TARGET_SEPARATOR
19+ from kernel_patches_daemon .github_sync import GithubSync
2020from tests .common .patchwork_mock import init_pw_responses , load_test_data , PatchworkMock
2121
2222TEST_BRANCH = "test-branch"
@@ -118,7 +118,7 @@ class TestCase:
118118 gh .workers [TEST_BRANCH ].ci_repo_dir .startswith (case .prefix ),
119119 )
120120
121- def test_close_existing_prs_with_same_base (self ) -> None :
121+ def test_close_existing_prs_for_series (self ) -> None :
122122 matching_pr_mock = MagicMock ()
123123 matching_pr_mock .title = "matching"
124124 matching_pr_mock .head .ref = "test_branch=>remote_branch"
@@ -137,7 +137,7 @@ def test_close_existing_prs_with_same_base(self) -> None:
137137 input_pr_mock .head .ref = "test_branch=>other_remote_branch"
138138
139139 workers = [copy .copy (branch_worker_mock ) for _ in range (2 )]
140- self ._gh .close_existing_prs_with_same_base (workers , input_pr_mock )
140+ self ._gh .close_existing_prs_for_series (workers , input_pr_mock )
141141 for worker in workers :
142142 self .assertEqual (len (worker .prs ), 1 )
143143 self .assertTrue ("irrelevant" in worker .prs )
@@ -202,7 +202,7 @@ async def test_sync_relevant_subject_no_mapped_branches(self) -> None:
202202
203203 async def test_sync_relevant_subject_success_first_branch (self ) -> None :
204204 series_prefix = "series/987654"
205- series_branch_name = f"{ series_prefix } { HEAD_BASE_SEPARATOR } { TEST_BRANCH } "
205+ series_branch_name = f"{ series_prefix } { SERIES_TARGET_SEPARATOR } { TEST_BRANCH } "
206206
207207 subject_mock , series_mock = self ._setup_sync_relevant_subject_mocks ()
208208 series_mock .all_tags = AsyncMock (return_value = ["multibranch-tag" ])
@@ -212,7 +212,7 @@ async def test_sync_relevant_subject_success_first_branch(self) -> None:
212212 pr_mock .head .ref = series_branch_name
213213
214214 self ._gh .checkout_and_patch_safe = AsyncMock (return_value = pr_mock )
215- self ._gh .close_existing_prs_with_same_base = MagicMock ()
215+ self ._gh .close_existing_prs_for_series = MagicMock ()
216216
217217 worker_mock = self ._gh .workers [TEST_BRANCH ]
218218 worker_mock .sync_checks = AsyncMock ()
@@ -229,15 +229,17 @@ async def test_sync_relevant_subject_success_first_branch(self) -> None:
229229 worker_mock , series_branch_name , series_mock
230230 )
231231 worker_mock .sync_checks .assert_called_once_with (pr_mock , series_mock )
232- self ._gh .close_existing_prs_with_same_base .assert_called_once_with (
232+ self ._gh .close_existing_prs_for_series .assert_called_once_with (
233233 list (self ._gh .workers .values ()), pr_mock
234234 )
235235
236236 async def test_sync_relevant_subject_success_second_branch (self ) -> None :
237237 """Test sync_relevant_subject when series fails on first branch but succeeds on second."""
238238 series_prefix = "series/333333"
239- bad_branch_name = f"{ series_prefix } { HEAD_BASE_SEPARATOR } { TEST_BRANCH } "
240- good_branch_name = f"{ series_prefix } { HEAD_BASE_SEPARATOR } { TEST_BPF_NEXT_BRANCH } "
239+ bad_branch_name = f"{ series_prefix } { SERIES_TARGET_SEPARATOR } { TEST_BRANCH } "
240+ good_branch_name = (
241+ f"{ series_prefix } { SERIES_TARGET_SEPARATOR } { TEST_BPF_NEXT_BRANCH } "
242+ )
241243
242244 subject_mock , series_mock = self ._setup_sync_relevant_subject_mocks ()
243245 series_mock .all_tags = AsyncMock (return_value = ["multibranch-tag" ])
@@ -246,7 +248,7 @@ async def test_sync_relevant_subject_success_second_branch(self) -> None:
246248 pr_mock .head .ref = good_branch_name
247249
248250 self ._gh .checkout_and_patch_safe = AsyncMock (return_value = pr_mock )
249- self ._gh .close_existing_prs_with_same_base = MagicMock ()
251+ self ._gh .close_existing_prs_for_series = MagicMock ()
250252
251253 bad_worker_mock = self ._gh .workers [TEST_BRANCH ]
252254 bad_worker_mock .sync_checks = AsyncMock ()
@@ -274,7 +276,7 @@ async def test_sync_relevant_subject_success_second_branch(self) -> None:
274276 good_worker_mock , good_branch_name , series_mock
275277 )
276278 good_worker_mock .sync_checks .assert_called_once_with (pr_mock , series_mock )
277- self ._gh .close_existing_prs_with_same_base .assert_called_once_with (
279+ self ._gh .close_existing_prs_for_series .assert_called_once_with (
278280 list (self ._gh .workers .values ()), pr_mock
279281 )
280282
0 commit comments