diff --git a/tests/test_utils/test_dl_utils/test_torch_ops.py b/tests/test_utils/test_dl_utils/test_torch_ops.py index 9fffaf7f53..03e5decf0d 100644 --- a/tests/test_utils/test_dl_utils/test_torch_ops.py +++ b/tests/test_utils/test_dl_utils/test_torch_ops.py @@ -1,5 +1,6 @@ # Copyright (c) OpenMMLab. All rights reserved. -import pytest +import warnings + import torch from mmengine.utils.dl_utils import torch_meshgrid @@ -7,9 +8,8 @@ def test_torch_meshgrid(): # torch_meshgrid should not throw warning - with pytest.warns(None) as record: + with warnings.catch_warnings(): + warnings.simplefilter('error') x = torch.tensor([1, 2, 3]) y = torch.tensor([4, 5, 6]) grid_x, grid_y = torch_meshgrid(x, y) - - assert len(record) == 0