Skip to content

Commit 629470e

Browse files
(PTFE-2480) Fix Suggestions
1 parent 6d84559 commit 629470e

File tree

4 files changed

+1
-98
lines changed

4 files changed

+1
-98
lines changed

bert_e/exceptions.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -573,12 +573,3 @@ class JobFailure(SilentException):
573573

574574
class QueueBuildFailed(SilentException):
575575
code = 309
576-
577-
578-
class UnsupportedBranchType(InternalException):
579-
code = 205
580-
581-
def __init__(self, branch_name):
582-
msg = ('Unsupported branch type: %r. '
583-
'Stabilization branches are no longer supported.' % branch_name)
584-
super(UnsupportedBranchType, self).__init__(msg)

bert_e/tests/test_bert_e.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -190,25 +190,6 @@ def dynamic_filtering(request):
190190
class QuickTest(unittest.TestCase):
191191
"""Tests which don't need to interact with an external web services"""
192192

193-
def test_unsupported_multiple_branches_exception(self):
194-
"""Test that UnsupportedMultipleBranches is raised
195-
when duplicate branches are added to cascade."""
196-
# Create a mock repository
197-
fake_repo = Mock()
198-
199-
# Create two development branches with the same version
200-
branch1 = gwfb.DevelopmentBranch(fake_repo, 'development/4.3')
201-
branch2 = gwfb.DevelopmentBranch(fake_repo, 'development/4.3')
202-
203-
# Create a cascade and add the first branch
204-
cascade = gwfb.BranchCascade()
205-
cascade.add_branch(branch1, None)
206-
207-
# Adding the second branch with the same type
208-
# and version should raise the exception
209-
with self.assertRaises(exns.UnsupportedMultipleBranches):
210-
cascade.add_branch(branch2, None)
211-
212193
def feature_branch(self, name):
213194
return gwfb.FeatureBranch(None, name)
214195

@@ -633,28 +614,6 @@ def test_cmd(self):
633614
self.assertLess(time.time() - start, 5)
634615
self.assertEqual('plop\n', cmd('echo plop'))
635616

636-
def test_unsupported_branch_type_stabilization(self):
637-
"""Test that stabilization branches are rejected
638-
with UnsupportedBranchType."""
639-
fake_repo = FakeGitRepo()
640-
641-
# Test various stabilization branch patterns
642-
stabilization_branches = [
643-
'stabilization/5.1.4',
644-
'stabilization/10.0.1',
645-
'stabilization/4.3.2'
646-
]
647-
648-
for branch_name in stabilization_branches:
649-
with self.assertRaises(exns.UnsupportedBranchType) as context:
650-
gwfb.branch_factory(fake_repo, branch_name)
651-
652-
# Verify the error message contains the branch name and explanation
653-
error_msg = str(context.exception)
654-
self.assertIn(branch_name, error_msg)
655-
self.assertIn('Stabilization branches are no longer supported',
656-
error_msg)
657-
658617

659618
class FakeGitRepo:
660619
def includes_commit(self, commit):

bert_e/tests/test_server.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -484,27 +484,13 @@ def test_create_branch_api_call(self):
484484
)
485485
self.assertEqual(401, resp.status_code)
486486

487-
resp = self.handle_api_call(
488-
'gwf/branches/stabilization/7.4.0',
489-
method='POST',
490-
user='test_user'
491-
)
492-
self.assertEqual(403, resp.status_code)
493-
494487
resp = self.handle_api_call(
495488
'gwf/branches/foo/7.4',
496489
method='POST',
497490
user='test_admin'
498491
)
499492
self.assertEqual(400, resp.status_code)
500493

501-
resp = self.handle_api_call(
502-
'gwf/branches/stabilization/7.4',
503-
method='POST',
504-
user='test_admin'
505-
)
506-
self.assertEqual(400, resp.status_code)
507-
508494
resp = self.handle_api_call(
509495
'gwf/branches/development/7.4',
510496
data={'branch_from': 'invalid'},
@@ -520,13 +506,6 @@ def test_create_branch_api_call(self):
520506
)
521507
self.assertEqual(400, resp.status_code)
522508

523-
resp = self.handle_api_call(
524-
'gwf/branches/stabilization/7.4.0',
525-
method='POST',
526-
user='test_admin'
527-
)
528-
self.assertEqual(400, resp.status_code)
529-
530509
resp = self.handle_api_call(
531510
'gwf/branches/development/7.4',
532511
method='POST',
@@ -559,41 +538,20 @@ def test_delete_branch_api_call(self):
559538
)
560539
self.assertEqual(401, resp.status_code)
561540

562-
resp = self.handle_api_call(
563-
'gwf/branches/stabilization/7.4.0',
564-
method='DELETE',
565-
user='test_user'
566-
)
567-
self.assertEqual(403, resp.status_code)
568-
569541
resp = self.handle_api_call(
570542
'gwf/branches/foo/7.4',
571543
method='DELETE',
572544
user='test_admin'
573545
)
574546
self.assertEqual(400, resp.status_code)
575547

576-
resp = self.handle_api_call(
577-
'gwf/branches/stabilization/7.4',
578-
method='DELETE',
579-
user='test_admin'
580-
)
581-
self.assertEqual(400, resp.status_code)
582-
583548
resp = self.handle_api_call(
584549
'gwf/branches/development/7.4_',
585550
method='DELETE',
586551
user='test_admin'
587552
)
588553
self.assertEqual(400, resp.status_code)
589554

590-
resp = self.handle_api_call(
591-
'gwf/branches/stabilization/7.4.0',
592-
method='DELETE',
593-
user='test_admin'
594-
)
595-
self.assertEqual(400, resp.status_code)
596-
597555
resp = self.handle_api_call(
598556
'gwf/branches/development/7.4',
599557
method='DELETE',

bert_e/workflow/gitwaterflow/branches.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -854,11 +854,6 @@ def add_branch(self, branch, dst_branch=None):
854854
sorted(self._cascade.items(), key=cmp_to_key(compare_branches))
855855
)
856856

857-
cur_branch = self._cascade[(major, minor)][branch.__class__]
858-
859-
if cur_branch:
860-
raise errors.UnsupportedMultipleBranches(cur_branch, branch)
861-
862857
self._cascade[(major, minor)][branch.__class__] = branch
863858

864859
def update_versions(self, tag):
@@ -960,7 +955,7 @@ def _set_target_versions(self, dst_branch):
960955
hf_branch.major, hf_branch.minor, hf_branch.micro,
961956
hf_branch.hfrev))
962957

963-
elif dev_branch and dev_branch.has_minor is True:
958+
if dev_branch and dev_branch.has_minor is True:
964959
offset = 1
965960

966961
self.target_versions.append('%d.%d.%d' % (

0 commit comments

Comments
 (0)