diff --git a/tests/conftest.py b/tests/conftest.py index 277ae631..670e1e33 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,5 @@ # Something in CellProfiler is importing wx before we can set -# headless mode. Setting headless here efore importing anything +# headless mode. Setting headless here before importing anything # else from CellProfiler. import cellprofiler_core.preferences @@ -10,6 +10,7 @@ import cellprofiler_core.object import cellprofiler_core.pipeline import cellprofiler_core.workspace +import cellprofiler_core.reader import numpy import skimage.data import skimage.color @@ -18,6 +19,9 @@ import pytest +def pytest_sessionstart(session): + cellprofiler_core.reader.fill_readers(check_config=True) + @pytest.fixture( scope="module", params=[ diff --git a/unmaintained_plugins/CellProfiler3/tests/conftest.py b/unmaintained_plugins/CellProfiler3/tests/conftest.py index 7da939d5..11e490fa 100644 --- a/unmaintained_plugins/CellProfiler3/tests/conftest.py +++ b/unmaintained_plugins/CellProfiler3/tests/conftest.py @@ -10,6 +10,7 @@ import cellprofiler.object import cellprofiler.pipeline import cellprofiler.workspace +import cellprofiler_core.reader import numpy import skimage.data import skimage.color @@ -18,6 +19,9 @@ import pytest +def pytest_sessionstart(session): + cellprofiler_core.reader.fill_readers(check_config=True) + @pytest.fixture( scope="module", params=[ diff --git a/unmaintained_tests/test_identifyyeastcells.py b/unmaintained_tests/test_identifyyeastcells.py index b4bce9a6..c71d20c1 100644 --- a/unmaintained_tests/test_identifyyeastcells.py +++ b/unmaintained_tests/test_identifyyeastcells.py @@ -102,7 +102,7 @@ def test_01_00_test_zero_objects(self): image = cpi.Image(img, file_name="test_01_00_test_zero_objects") image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) - image_set.providers.append(cpi.VanillaImageProvider(IMAGE_NAME, image)) + image_set.add_provider(cpi.VanillaImageProvider(IMAGE_NAME, image)) object_set = cpo.ObjectSet() measurements = cpmeas.Measurements() pipeline = cellprofiler.pipeline.Pipeline() @@ -137,7 +137,7 @@ def test_01_01_test_one_object(self): image = cpi.Image(img, file_name="test_01_01_test_one_object") image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) - image_set.providers.append(cpi.VanillaImageProvider(IMAGE_NAME, image)) + image_set.add_provider(cpi.VanillaImageProvider(IMAGE_NAME, image)) object_set = cpo.ObjectSet() measurements = cpmeas.Measurements() pipeline = cellprofiler.pipeline.Pipeline() @@ -182,7 +182,7 @@ def test_01_02_test_two_bright_objects(self): image = cpi.Image(img, file_name="test_01_02_test_two_bright_objects") image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) - image_set.providers.append(cpi.VanillaImageProvider(IMAGE_NAME, image)) + image_set.add_provider(cpi.VanillaImageProvider(IMAGE_NAME, image)) object_set = cpo.ObjectSet() measurements = cpmeas.Measurements() pipeline = cellprofiler.pipeline.Pipeline() @@ -218,7 +218,7 @@ def test_01_03_test_two_dark_objects(self): image = cpi.Image(img, file_name="test_01_03_test_two_dark_objects") image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) - image_set.providers.append(cpi.VanillaImageProvider(IMAGE_NAME, image)) + image_set.add_provider(cpi.VanillaImageProvider(IMAGE_NAME, image)) object_set = cpo.ObjectSet() measurements = cpmeas.Measurements() pipeline = cellprofiler.pipeline.Pipeline() @@ -256,7 +256,7 @@ def test_01_04_test_two_flu_bright_objects(self): image = cpi.Image(img, file_name="test_01_04_test_two_flu_bright_objects") image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) - image_set.providers.append(cpi.VanillaImageProvider(IMAGE_NAME, image)) + image_set.add_provider(cpi.VanillaImageProvider(IMAGE_NAME, image)) object_set = cpo.ObjectSet() measurements = cpmeas.Measurements() pipeline = cellprofiler.pipeline.Pipeline() @@ -294,7 +294,7 @@ def test_01_05_test_two_flu_dark_objects(self): image = cpi.Image(img, file_name="test_01_05_test_two_flu_dark_objects") image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) - image_set.providers.append(cpi.VanillaImageProvider(IMAGE_NAME, image)) + image_set.add_provider(cpi.VanillaImageProvider(IMAGE_NAME, image)) object_set = cpo.ObjectSet() measurements = cpmeas.Measurements() pipeline = cellprofiler.pipeline.Pipeline() @@ -336,7 +336,7 @@ def test_01_06_fill_holes(self): image = cpi.Image(img, file_name="test_01_06_fill_holes") image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) - image_set.providers.append(cpi.VanillaImageProvider(IMAGE_NAME, image)) + image_set.add_provider(cpi.VanillaImageProvider(IMAGE_NAME, image)) object_set = cpo.ObjectSet() measurements = cpmeas.Measurements() pipeline = cellprofiler.pipeline.Pipeline() @@ -359,7 +359,7 @@ def test_01_07_extreme_params(self): image = cpi.Image(img, file_name="test_01_07_extreme_params") image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) - image_set.providers.append(cpi.VanillaImageProvider(IMAGE_NAME, image)) + image_set.add_provider(cpi.VanillaImageProvider(IMAGE_NAME, image)) object_set = cpo.ObjectSet() measurements = cpmeas.Measurements() pipeline = cellprofiler.pipeline.Pipeline() @@ -387,7 +387,7 @@ def test_02_01_discard_large(self): image = cpi.Image(img, file_name="test_02_01_discard_large") image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) - image_set.providers.append(cpi.VanillaImageProvider(IMAGE_NAME, image)) + image_set.add_provider(cpi.VanillaImageProvider(IMAGE_NAME, image)) object_set = cpo.ObjectSet() measurements = cpmeas.Measurements() pipeline = cellprofiler.pipeline.Pipeline() @@ -418,7 +418,7 @@ def test_02_02_discard_small(self): image = cpi.Image(img, file_name="test_02_02_discard_small") image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) - image_set.providers.append(cpi.VanillaImageProvider(IMAGE_NAME, image)) + image_set.add_provider(cpi.VanillaImageProvider(IMAGE_NAME, image)) object_set = cpo.ObjectSet() measurements = cpmeas.Measurements() pipeline = cellprofiler.pipeline.Pipeline() @@ -454,8 +454,8 @@ def test_02_03_use_background_image(self): image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) - image_set.providers.append(cpi.VanillaImageProvider(IMAGE_NAME, image)) - image_set.providers.append(cpi.VanillaImageProvider(BACKGROUND_IMAGE_NAME, background)) + image_set.add_provider(cpi.VanillaImageProvider(IMAGE_NAME, image)) + image_set.add_provider(cpi.VanillaImageProvider(BACKGROUND_IMAGE_NAME, background)) object_set = cpo.ObjectSet() measurements = cpmeas.Measurements() pipeline = cellprofiler.pipeline.Pipeline() @@ -487,8 +487,8 @@ def test_02_04_mask_input_image(self): mask = cpi.Image(msk) image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) - image_set.providers.append(cpi.VanillaImageProvider(IMAGE_NAME, image)) - image_set.providers.append(cpi.VanillaImageProvider(MASK_IMAGE_NAME, mask)) + image_set.add_provider(cpi.VanillaImageProvider(IMAGE_NAME, image)) + image_set.add_provider(cpi.VanillaImageProvider(MASK_IMAGE_NAME, mask)) # first try without masking object_set = cpo.ObjectSet() @@ -548,7 +548,7 @@ def test_03_01_simple_fitting(self): image = cpi.Image(img, file_name="test_03_01_simple_fitting") image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) - image_set.providers.append(cpi.VanillaImageProvider(IMAGE_NAME, image)) + image_set.add_provider(cpi.VanillaImageProvider(IMAGE_NAME, image)) old_params = ast.literal_eval(x.autoadapted_params.value) input_processed, background_processed, ignore_mask_processed = x.preprocess_images(img, None, None) @@ -629,9 +629,9 @@ def test_03_02_fitting_background_masked(self): image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) - image_set.providers.append(cpi.VanillaImageProvider(IMAGE_NAME, image)) - image_set.providers.append(cpi.VanillaImageProvider(MASK_IMAGE_NAME, mask)) - image_set.providers.append(cpi.VanillaImageProvider(BACKGROUND_IMAGE_NAME, background)) + image_set.add_provider(cpi.VanillaImageProvider(IMAGE_NAME, image)) + image_set.add_provider(cpi.VanillaImageProvider(MASK_IMAGE_NAME, mask)) + image_set.add_provider(cpi.VanillaImageProvider(BACKGROUND_IMAGE_NAME, background)) old_params = ast.literal_eval(x.autoadapted_params.value) input_processed, background_processed, ignore_mask_processed = x.preprocess_images(img, background_mask, ignore_mask)