mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-12 12:30:16 +08:00
Restore plugin registry after testing.
This commit is contained in:
@@ -3,7 +3,7 @@ from numpy.testing import *
|
|||||||
from scikits.image import io
|
from scikits.image import io
|
||||||
from scikits.image.io import plugin
|
from scikits.image.io import plugin
|
||||||
|
|
||||||
from copy import copy
|
from copy import deepcopy
|
||||||
|
|
||||||
def read(fname, as_grey=False, dtype=None):
|
def read(fname, as_grey=False, dtype=None):
|
||||||
assert fname == 'test.png'
|
assert fname == 'test.png'
|
||||||
@@ -18,11 +18,14 @@ def show(arr, plugin_arg=None):
|
|||||||
assert arr == [1, 2, 3]
|
assert arr == [1, 2, 3]
|
||||||
assert plugin_arg == (1, 2)
|
assert plugin_arg == (1, 2)
|
||||||
|
|
||||||
class TestPlugin:
|
def setup_module(self):
|
||||||
def setup(self):
|
self.backup_plugin_store = deepcopy(plugin.plugin_store)
|
||||||
self.backup_plugin_store = copy(plugin.plugin_store)
|
plugin.register('test', read=read, save=save, show=show)
|
||||||
plugin.register('test', read=read, save=save, show=show)
|
|
||||||
|
|
||||||
|
def teardown_module(self):
|
||||||
|
plugin.plugin_store = self.backup_plugin_store
|
||||||
|
|
||||||
|
class TestPlugin:
|
||||||
def test_read(self):
|
def test_read(self):
|
||||||
io.imread('test.png', as_grey=True, dtype='i4', plugin='test')
|
io.imread('test.png', as_grey=True, dtype='i4', plugin='test')
|
||||||
|
|
||||||
@@ -32,9 +35,5 @@ class TestPlugin:
|
|||||||
def test_show(self):
|
def test_show(self):
|
||||||
io.imshow([1, 2, 3], plugin_arg=(1, 2), plugin='test')
|
io.imshow([1, 2, 3], plugin_arg=(1, 2), plugin='test')
|
||||||
|
|
||||||
def teardown(self):
|
|
||||||
plugin.plugin_store = self.backup_plugin_store
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
run_module_suite()
|
run_module_suite()
|
||||||
|
|||||||
Reference in New Issue
Block a user