Skip to content

Commit

Permalink
More test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
constantinpape committed Oct 18, 2024
1 parent 55d0f5b commit a01fad1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/test_sam_annotator/test_widgets.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import json
import os
import platform
import warnings

from mobile_sam.predictor import SamPredictor as MobileSamPredictor
# Avoid import warnigns from mobile_sam
with warnings.catch_warnings():
warnings.simplefilter("ignore")
from mobile_sam.predictor import SamPredictor as MobileSamPredictor
from segment_anything.predictor import SamPredictor
import numpy as np
import pytest
Expand Down Expand Up @@ -33,8 +37,11 @@ def test_embedding_widget(make_napari_viewer, tmp_path):
my_widget.embeddings_save_path = tmp_path

# Run image embedding widget.
worker = my_widget(skip_validate=True)
worker.await_workers() # blocks until thread worker is finished the embedding
my_widget(skip_validate=True)

# Previous version when we used a thread-worker
# worker = my_widget(skip_validate=True)
# worker.await_workers() # blocks until thread worker is finished the embedding

# Check in-memory state for predictor and embeddings.
assert isinstance(AnnotatorState().predictor, (SamPredictor, MobileSamPredictor))
Expand Down

0 comments on commit a01fad1

Please sign in to comment.