Simplify warning test

This commit is contained in:
Stefan van der Walt
2014-11-11 00:32:02 +02:00
parent 046fe99e4e
commit e8ee365382
2 changed files with 12 additions and 11 deletions
+10 -8
View File
@@ -1,12 +1,14 @@
from skimage._shared.utils import skimage_deprecation
from warnings import warn_explicit
__warningregistry__ = {}
warn_explicit(skimage_deprecation('The `skimage.filter` module has been renamed to '
'`skimage.filters`. This placeholder module '
'will be removed in v0.13.'), category=None,
filename=__file__, lineno=4,
registry=__warningregistry__)
del warn_explicit
from warnings import warn
global _import_warned
warn(skimage_deprecation('The `skimage.filter` module has been renamed '
'to `skimage.filters`. This placeholder module '
'will be removed in v0.13.'))
_import_warned = True
del warn
del skimage_deprecation
from ..filters import *
+2 -3
View File
@@ -3,9 +3,8 @@ from warnings import catch_warnings, simplefilter
def test_filter_import():
with catch_warnings():
simplefilter('always')
simplefilter('ignore')
from skimage import filter as F
assert('sobel' in dir(F))
assert any(['has been renamed' in w
for (w, _, _) in F.__warningregistry__])
assert F._import_warned