Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions components/tools/OmeroPy/test/integration/test_thumbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

from omero.testlib import ITest
import pytest
import time
import os

from omero import MissingPyramidException
from omero.sys import ParametersI
Expand Down Expand Up @@ -86,6 +88,24 @@ def testThumbnailExists(self):
finally:
tb.close()

def wait_for_pyramid_file(self, pixels_id, timeout=120):
pixels_dir = (
"/home/omero/workspace/"
"OMERO-test-integration/data/Pixels"
)
expected = f"{pixels_id}_pyramid"

deadline = time.time() + timeout
while time.time() < deadline:
for root, _, files in os.walk(pixels_dir):
if expected in files:
return
time.sleep(1)

pytest.fail(
f"Timed out waiting for pyramid file {expected}"
)

@pytest.mark.parametrize("meth", ("one", "set",))
def testThumbnailVersion(self, meth):

Expand Down Expand Up @@ -146,16 +166,21 @@ def get():
# the pyramid is generated.
tb.close()
tb = self.client.sf.createThumbnailStore()
# Wait for pyramid gen - slower on NFS
# and needs a check via FS.
self.wait_for_pyramid_file(pix)
if not tb.setPixelsId(int(pix)):
tb.resetDefaults()
tb.close()

tb = self.client.sf.createThumbnailStore()
assert tb.setPixelsId(int(pix))
after = tb.getThumbnail(i64, i64)
assert before != after
assert tb.thumbnailExists(i64, i64)
assert not tb.isInProgress()
elif meth == "set":
self.wait_for_pyramid_file(pix)
tb.getThumbnailSet(i64, i64, [int(pix)])
assert get().version.val >= 0

Expand Down
Loading