mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-28 23:57:58 +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.io import plugin
|
||||
|
||||
from copy import copy
|
||||
from copy import deepcopy
|
||||
|
||||
def read(fname, as_grey=False, dtype=None):
|
||||
assert fname == 'test.png'
|
||||
@@ -18,11 +18,14 @@ def show(arr, plugin_arg=None):
|
||||
assert arr == [1, 2, 3]
|
||||
assert plugin_arg == (1, 2)
|
||||
|
||||
class TestPlugin:
|
||||
def setup(self):
|
||||
self.backup_plugin_store = copy(plugin.plugin_store)
|
||||
plugin.register('test', read=read, save=save, show=show)
|
||||
def setup_module(self):
|
||||
self.backup_plugin_store = deepcopy(plugin.plugin_store)
|
||||
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):
|
||||
io.imread('test.png', as_grey=True, dtype='i4', plugin='test')
|
||||
|
||||
@@ -32,9 +35,5 @@ class TestPlugin:
|
||||
def test_show(self):
|
||||
io.imshow([1, 2, 3], plugin_arg=(1, 2), plugin='test')
|
||||
|
||||
def teardown(self):
|
||||
plugin.plugin_store = self.backup_plugin_store
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_module_suite()
|
||||
|
||||
Reference in New Issue
Block a user