Skip to content

Commit

Permalink
ARR test: remove loop to retry get notes and wait for process to fini…
Browse files Browse the repository at this point in the history
…sh instead (#2470)

* remove loop

* fix error message

* clean test
  • Loading branch information
melisabok authored Jan 15, 2025
1 parent 469c752 commit 2e8d4ce
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
4 changes: 4 additions & 0 deletions openreview/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,7 @@ def get_notes(self, id = None,
offset = None,
after = None,
mintcdate = None,
domain = None,
details = None,
sort = None,
with_count=False
Expand Down Expand Up @@ -1204,6 +1205,7 @@ def get_notes(self, id = None,
:param mintcdate: Represents an Epoch time timestamp, in milliseconds. If provided, returns Notes
whose "true creation date" (tcdate) is at least equal to the value of mintcdate.
:type mintcdate: int, optional
:param domain: If provided, returns Notes whose domain field matches the given domain.
:param details: TODO: What is a valid value for this field?
:type details: optional
:param sort: Sorts the output by field depending on the string passed. Possible values: number, cdate, ddate, tcdate, tmdate, replyCount (Invitation id needed in the invitation field).
Expand Down Expand Up @@ -1246,6 +1248,8 @@ def get_notes(self, id = None,
params['offset'] = offset
if mintcdate is not None:
params['mintcdate'] = mintcdate
if domain is not None:
params['domain'] = domain
if details is not None:
params['details'] = details
if after is not None:
Expand Down
38 changes: 22 additions & 16 deletions tests/test_arr_venue_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3543,6 +3543,10 @@ def test_sae_ae_assignments(self, client, openreview_client, helpers, test_clien
)))

helpers.await_queue_edit(openreview_client, edit_id=existing_edges[-1].id)

assert '~Reviewer_ARRSix1' in openreview_client.get_group('aclweb.org/ACL/ARR/2023/August/Submission2/Reviewers').members
reviewer_six_client.get_note(june_submissions[1].id, details='replies')

existing_edges.append(openreview_client.post_edge(openreview.api.Edge(
invitation = 'aclweb.org/ACL/ARR/2023/August/Reviewers/-/Assignment',
head = submissions[2].id,
Expand All @@ -3552,28 +3556,16 @@ def test_sae_ae_assignments(self, client, openreview_client, helpers, test_clien
)))
helpers.await_queue_edit(openreview_client, edit_id=existing_edges[-1].id)

## Fetch corresponding June submissions with details replies using reviewer client, check replies for official reviews
retries, MAX_RETRIES = 0, 10
retry = True
while retries < MAX_RETRIES and retry:
try:
reviewer_six_client.get_note(june_submissions[2].id, details='replies')
retry = True
time.sleep(2)
except Exception as e:
retry = False
break
same_note = reviewer_six_client.get_note(june_submissions[1].id, details='replies')
with pytest.raises(openreview.OpenReviewException, match=r'User Reviewer ARRSix does not have permission to see'):
assert '~Reviewer_ARRSix1' in openreview_client.get_group('aclweb.org/ACL/ARR/2023/August/Submission3/Reviewers').members
with pytest.raises(openreview.OpenReviewException, match=r'User Reviewer ARRSix does not have permission to see Note ' + june_submissions[2].id):
reviewer_six_client.get_note(june_submissions[2].id, details='replies')
assert len(
[r for r in same_note.details['replies'] if r['invitations'][0].endswith('Official_Review')]
) == 2


## Clean up data
for edge in existing_edges:
edge.ddate = openreview.tools.datetime_millis(now)
openreview_client.post_edge(edge)
helpers.await_queue_edit(openreview_client, edit_id=edge.id, count=2)

def test_checklists(self, client, openreview_client, helpers, test_client, request_page, selenium):
pc_client=openreview.Client(username='[email protected]', password=helpers.strong_password)
Expand Down Expand Up @@ -5513,6 +5505,10 @@ def test_commitment_venue(self, client, test_client, openreview_client, helpers)
}
))

pc_client_v2 = openreview.api.OpenReviewClient(username='[email protected]', password=helpers.strong_password)
notes = pc_client_v2.get_notes(invitation='aclweb.org/ACL/ARR/2023/August/-/Submission', number=3)
assert len(notes) == 0

openreview.arr.ARR.process_commitment_venue(openreview_client, 'aclweb.org/ACL/2024/Workshop/C3NLP_ARR_Commitment')

august_submissions = openreview_client.get_notes(invitation='aclweb.org/ACL/ARR/2023/August/-/Submission', sort='number:asc')
Expand All @@ -5522,6 +5518,16 @@ def test_commitment_venue(self, client, test_client, openreview_client, helpers)

reviews = openreview_client.get_notes(invitation='aclweb.org/ACL/ARR/2023/August/Submission3/-/Official_Review')
assert 'aclweb.org/ACL/ARR/2023/August/Submission3/Commitment_Readers' in reviews[0].readers

notes = pc_client_v2.get_notes(invitation='aclweb.org/ACL/ARR/2023/August/-/Submission', number=3)
assert len(notes) == 1
submssion3 = notes[0]

notes = pc_client_v2.get_notes(invitation='aclweb.org/ACL/ARR/2023/August/Submission3/-/Official_Review')
assert len(notes) == 1

notes = pc_client_v2.get_notes(forum=submssion3.id, domain='aclweb.org/ACL/ARR/2023/August')
assert len(notes) == 3

venue = openreview.helpers.get_conference(client, request_form_note.forum)
venue.invitation_builder.expire_invitation('aclweb.org/ACL/2024/Workshop/C3NLP_ARR_Commitment/Senior_Area_Chairs/-/Submission_Group')
Expand Down

0 comments on commit 2e8d4ce

Please sign in to comment.