Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.

Commit df74683

Browse files
Merge pull request #424 from Mark-Simulacrum/recursion-not-an-error
Avoid an assertion error on double-adding a group
2 parents cfd6a84 + cde84b5 commit df74683

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

highfive/newpr.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,10 @@ def pick_reviewer(self, groups, potential, exclude):
343343
reviewers.append(username)
344344
elif p in groups:
345345
# avoid infinite loops
346-
assert p not in seen, "group %s refers to itself" % p
347-
seen.add(p)
348-
# we allow groups in groups, so they need to be queued to be resolved
349-
potential.extend(groups[p])
346+
if p not in seen:
347+
seen.add(p)
348+
# we allow groups in groups, so they need to be queued to be resolved
349+
potential.extend(groups[p])
350350

351351
if reviewers:
352352
random.seed()

highfive/tests/test_newpr.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,10 +1160,10 @@ def test_circular_groups(self):
11601160
handler = HighfiveHandlerMock(
11611161
Payload({}), repo_config=self.fakes['config']['circular_groups']
11621162
).handler
1163-
with pytest.raises(AssertionError):
1164-
handler.choose_reviewer(
1165-
'rust', 'rust-lang', self.fakes['diff']['normal'], 'fooauthor'
1166-
)
1163+
chosen_reviewers = handler.choose_reviewer(
1164+
'rust', 'rust-lang', self.fakes['diff']['normal'], 'fooauthor'
1165+
)
1166+
assert chosen_reviewers is None
11671167

11681168
def test_nested_groups(self):
11691169
"""Test choosing a reviewer from group with nested groups.

0 commit comments

Comments
 (0)