提交 f74a9d81 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Fix problem with testing unpickling.

上级 a95f8af1
...@@ -18,6 +18,8 @@ from theano.compat import PY3 ...@@ -18,6 +18,8 @@ from theano.compat import PY3
from theano import config from theano import config
from theano.misc.pkl_utils import CompatUnpickler from theano.misc.pkl_utils import CompatUnpickler
from ..type import ContextNotDefined
try: try:
from . import config as _ # noqa from . import config as _ # noqa
have_pygpu = True have_pygpu = True
...@@ -26,11 +28,9 @@ except SkipTest: ...@@ -26,11 +28,9 @@ except SkipTest:
def test_unpickle_gpuarray_as_numpy_ndarray_flag1(): def test_unpickle_gpuarray_as_numpy_ndarray_flag1():
"""Only test when pygpu isn't # Only test when pygpu isn't
available. test_unpickle_gpuarray_as_numpy_ndarray_flag0 in # available. test_unpickle_gpuarray_as_numpy_ndarray_flag0 in
test_type.py test it when pygpu is there. # test_type.py test it when pygpu is there.
"""
if have_pygpu: if have_pygpu:
raise SkipTest("pygpu active") raise SkipTest("pygpu active")
oldflag = config.experimental.unpickle_gpu_on_cpu oldflag = config.experimental.unpickle_gpu_on_cpu
...@@ -45,7 +45,7 @@ def test_unpickle_gpuarray_as_numpy_ndarray_flag1(): ...@@ -45,7 +45,7 @@ def test_unpickle_gpuarray_as_numpy_ndarray_flag1():
u = CompatUnpickler(fp, encoding="latin1") u = CompatUnpickler(fp, encoding="latin1")
else: else:
u = CompatUnpickler(fp) u = CompatUnpickler(fp)
assert_raises(ImportError, u.load) assert_raises((ImportError, ContextNotDefined), u.load)
finally: finally:
config.experimental.unpickle_gpu_on_cpu = oldflag config.experimental.unpickle_gpu_on_cpu = oldflag
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论