mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-05 09:24:40 +08:00
Remove null plugin since we have the pil plugin as a requirement
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
[null]
|
||||
description = Default plugin that does nothing
|
||||
provides = imshow, imread, imsave, _app_show
|
||||
@@ -1,25 +0,0 @@
|
||||
__all__ = ['imshow', 'imread', 'imsave', '_app_show']
|
||||
|
||||
import warnings
|
||||
|
||||
message = '''\
|
||||
No plugin has been loaded. Please refer to the docstring for ``skimage.io``
|
||||
for a list of available plugins. You may specify a plugin explicitly as
|
||||
an argument to ``imread``, e.g. ``imread("image.jpg", plugin='pil')``.
|
||||
|
||||
'''
|
||||
|
||||
|
||||
def imshow(*args, **kwargs):
|
||||
warnings.warn(RuntimeWarning(message))
|
||||
|
||||
|
||||
def imread(*args, **kwargs):
|
||||
warnings.warn(RuntimeWarning(message))
|
||||
|
||||
|
||||
def imsave(*args, **kwargs):
|
||||
warnings.warn(RuntimeWarning(message))
|
||||
|
||||
|
||||
_app_show = imshow
|
||||
@@ -44,7 +44,7 @@ plugin_meta_data = {}
|
||||
# the following preferences.
|
||||
preferred_plugins = {
|
||||
# Default plugins for all types (overridden by specific types below).
|
||||
'all': ['pil', 'matplotlib', 'qt', 'freeimage', 'null']
|
||||
'all': ['pil', 'matplotlib', 'qt', 'freeimage']
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
import os
|
||||
import warnings
|
||||
from contextlib import contextmanager
|
||||
|
||||
import numpy as np
|
||||
from numpy.testing import raises
|
||||
|
||||
from skimage import io
|
||||
from skimage import data_dir
|
||||
|
||||
|
||||
@contextmanager
|
||||
def warnings_as_errors():
|
||||
# Temporarily set warnings as errors so we can test the warning is raised.
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings('error')
|
||||
yield
|
||||
|
||||
@raises(Warning)
|
||||
def test_null_imread():
|
||||
path = os.path.join(data_dir, 'color.png')
|
||||
with warnings_as_errors():
|
||||
io.imread(path, plugin='null')
|
||||
|
||||
|
||||
@raises(Warning)
|
||||
def test_null_imsave():
|
||||
with warnings_as_errors():
|
||||
io.imsave('dummy.png', np.zeros((3, 3)), plugin='null')
|
||||
|
||||
|
||||
@raises(Warning)
|
||||
def test_null_imshow():
|
||||
with warnings_as_errors():
|
||||
io.imshow(np.zeros((3, 3)), plugin='null')
|
||||
|
||||
|
||||
@raises(Warning)
|
||||
def test_null_imread_collection():
|
||||
# Note that the null plugin doesn't define an `imread_collection` plugin
|
||||
# but this function is dynamically added by the plugin manager.
|
||||
path = os.path.join(data_dir, '*.png')
|
||||
with warnings_as_errors():
|
||||
collection = io.imread_collection(path, plugin='null')
|
||||
collection[0]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from numpy.testing import run_module_suite
|
||||
run_module_suite()
|
||||
Reference in New Issue
Block a user