Skip to content

Commit 6d813d1

Browse files
[PTFE-583] ✨ Prevent creation of integration branches
1 parent eabb154 commit 6d813d1

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

bert_e/tests/test_bert_e.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,14 +1250,15 @@ def test_request_integration_branch_by_creating_pull_requests(self):
12501250
pr.id, settings=settings, options=options, backtrace=True)
12511251
self.assertEqual(len(list(pr.get_comments())), 4)
12521252
self.assertIn('Integration data created', self.get_last_pr_comment(pr))
1253-
1253+
12541254
options = self.bypass_all
12551255
with self.assertRaises(exns.SuccessMessage):
12561256
self.handle(
12571257
pr.id, settings=settings, options=options, backtrace=True)
12581258

12591259
self.assertIn(
1260-
'I have successfully merged the changeset', self.get_last_pr_comment(pr))
1260+
'I have successfully merged the changeset',
1261+
self.get_last_pr_comment(pr))
12611262

12621263
def test_creation_integration_branch_by_approve(self):
12631264
"""Test pr.approve() to request integration branches creation.
@@ -1291,19 +1292,21 @@ def test_creation_integration_branch_by_approve(self):
12911292
prs = [pr_1, pr_2]
12921293

12931294
for pr in prs:
1294-
options = self.bypass_all_but(['bypass_build_status', 'bypass_author_approval'])
1295+
options = self.bypass_all_but(['bypass_build_status',
1296+
'bypass_author_approval'])
12951297
with self.assertRaises(exns.ApprovalRequired):
12961298
self.handle(pr.id, options=options, backtrace=True)
12971299

12981300
self.assertEqual(len(list(pr.get_comments())), 3)
12991301

13001302
self.assertIn(
1301-
'Integration data created', list(pr.get_comments())[-2].text)
1303+
'Integration data created', list(pr.get_comments())[-2].text)
13021304

13031305
self.assertIn(
13041306
'Waiting for approval', self.get_last_pr_comment(pr))
13051307
self.assertIn(
1306-
'The following approvals are needed', self.get_last_pr_comment(pr))
1308+
'The following approvals are needed',
1309+
self.get_last_pr_comment(pr))
13071310

13081311
if pr.src_branch == "feature/TEST-0069":
13091312
pr.approve()
@@ -1318,9 +1321,10 @@ def test_creation_integration_branch_by_approve(self):
13181321
with self.assertRaises(exns.SuccessMessage):
13191322
self.handle(
13201323
pr.id, settings=settings, options=options, backtrace=True)
1321-
1324+
13221325
self.assertIn(
1323-
'I have successfully merged the changeset', self.get_last_pr_comment(pr))
1326+
'I have successfully merged the changeset',
1327+
self.get_last_pr_comment(pr))
13241328

13251329
def test_integration_branch_creation_latest_branch(self):
13261330
"""Test there is no comment to request integration branches creation.

bert_e/workflow/gitwaterflow/integration.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,15 @@ def check_integration_branches(job):
145145
approved_by_author = job.pull_request.author in approvals
146146

147147
create_integration = (job.settings.always_create_integration_branches or
148-
job.settings.create_integration_branches)
148+
job.settings.create_integration_branches)
149149
create_prs = (job.settings.always_create_integration_pull_requests or
150-
job.settings.create_pull_requests)
150+
job.settings.create_pull_requests)
151151
multiple_dst_branches = len(job.git.cascade.dst_branches) <= 1
152152

153-
if not (create_integration
154-
or create_prs
155-
or approved_by_author
156-
or multiple_dst_branches):
153+
if not (create_integration or
154+
create_prs or
155+
approved_by_author or
156+
multiple_dst_branches):
157157
raise exceptions.RequestIntegrationBranches(
158158
active_options=job.active_options,
159159
)

0 commit comments

Comments
 (0)