Use assert_warns
@@ -265,6 +265,7 @@ class TestSingleDeviceMemoryPool(unittest.TestCase):
p1 = self.pool.malloc(self.unit * 4)
ptr1 = p1.ptr
del p1
+ with testing.assert_warns(DeprecationWarning):
self.pool.free_all_free()
p2 = self.pool.malloc(self.unit * 4)
self.assertNotEqual(ptr1, p2.ptr)
@@ -352,12 +353,14 @@ class TestMemoryPool(unittest.TestCase):
self.assertEqual(self.pool.n_free_blocks(), 0)
mem.free()
self.assertEqual(self.pool.n_free_blocks(), 1)
+ with testing.assert_warns(DeprecationWarning):
self.pool.free_all_free()
self.assertEqual(self.pool.n_free_blocks(), 0)
def test_free_all_free_without_malloc(self):
with cupy.cuda.Device(0):
# call directly without malloc.
+ with testing.assert_warns(DeprecationWarning):
self.pool.free_all_free()
self.assertEqual(self.pool.n_free_blocks(), 0)
