Restore plugin registry after testing.

This commit is contained in:
Stefan van der Walt
2009-11-01 11:56:21 +02:00
parent a7b17bb21b
commit cdb1a1560f
+8 -9
View File
@@ -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()