def test_load_preferred_plugins_all(): from skimage.io._plugins import pil_plugin with protect_preferred_plugins(): manage_plugins.preferred_plugins = {'all': ['pil']} manage_plugins.reset_plugins() for plugin_type in ('imread', 'imsave', 'imshow'): plug, func = manage_plugins.plugin_store[plugin_type][0] assert func == getattr(pil_plugin, plugin_type)
def test_load_preferred_plugins_imread(): from skimage.io._plugins import pil_plugin, matplotlib_plugin with protect_preferred_plugins(): manage_plugins.preferred_plugins['imread'] = ['pil'] manage_plugins.reset_plugins() plug, func = manage_plugins.plugin_store['imread'][0] assert func == pil_plugin.imread plug, func = manage_plugins.plugin_store['imshow'][0] assert func == matplotlib_plugin.imshow, func.__module__
def test_load_preferred_plugins_imread(): from skimage.io._plugins import null_plugin with protect_preferred_plugins(): manage_plugins.preferred_plugins['imread'] = ['null'] manage_plugins.reset_plugins() plug, func = manage_plugins.plugin_store['imread'][0] assert func == null_plugin.imread plug, func = manage_plugins.plugin_store['imshow'][0] assert func != null_plugin.imshow