Skip to content

Commit ba5eed8

Browse files
authored
[Fix] Fix warning capture (#1494)
1 parent f79111e commit ba5eed8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Copyright (c) OpenMMLab. All rights reserved.
2-
import pytest
2+
import warnings
3+
34
import torch
45

56
from mmengine.utils.dl_utils import torch_meshgrid
67

78

89
def test_torch_meshgrid():
910
# torch_meshgrid should not throw warning
10-
with pytest.warns(None) as record:
11+
with warnings.catch_warnings():
12+
warnings.simplefilter('error')
1113
x = torch.tensor([1, 2, 3])
1214
y = torch.tensor([4, 5, 6])
1315
grid_x, grid_y = torch_meshgrid(x, y)
14-
15-
assert len(record) == 0

0 commit comments

Comments
 (0)