catch_warnings of Python2.7 has a bug
@@ -2,6 +2,7 @@ import unittest
import warnings
import numpy
+import six
import chainer
from chainer import cuda
@@ -43,9 +44,12 @@ class TestCuda(unittest.TestCase):
self.assertIs(cuda.get_device(x), cuda.DummyDevice)
@attr.gpu
- def test_get_device_creates_warning(self):
+ def test_get_device_warning(self):
+ # NOTE: Python2.7 has a bug in catch_warnings, so this test is skipped
+ # for Python2.7
+ if six.PY3:
with warnings.catch_warnings(record=True) as w:
- warnings.simplefilter('always')
+ warnings.simplefilter('error')
cuda.get_device(cuda.cupy.array([1]))
self.assertEqual(len(w), 1)
