Remove null plugin since we have the pil plugin as a requirement

This commit is contained in:
Steven Silvester
2014-11-02 06:28:17 -06:00
parent 4eef9c5f75
commit 21d6ef15ec
4 changed files with 1 additions and 79 deletions
-3
View File
@@ -1,3 +0,0 @@
[null]
description = Default plugin that does nothing
provides = imshow, imread, imsave, _app_show
-25
View File
@@ -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
+1 -1
View File
@@ -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']
}
-50
View File
@@ -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()