Skip to content

Commit

Permalink
Have test wait for async operation
Browse files Browse the repository at this point in the history
  • Loading branch information
bctcvai committed Jul 26, 2024
1 parent 6c88af7 commit 7de90bd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import tarfile
import pytest
import inspect
import time

import tator

Expand Down Expand Up @@ -407,6 +408,15 @@ def referenced_image(request, base_url, token, page_factory, project, image_sect
'reference_only': 1
}
response = api.create_media_list(project, [media_spec])
media_resp = api.get_media(response.id[0]).to_dict()
attempts = 0
while (
media_resp["media_files"] is None or len(media_resp["media_files"].get("image", [])) < 1
) and attempts < 30:
print(f"Waiting for async image job {attempts+1}/30")
media_resp = api.get_media(response.id[0]).to_dict()
time.sleep(1)
attempts += 1
yield response.id[0]

@pytest.fixture(scope='session')
Expand Down

0 comments on commit 7de90bd

Please sign in to comment.