Skip to content

Commit 50b0193

Browse files
authored
fix warning leaking out of test in test_methods (#5362)
1 parent 2fa818b commit 50b0193

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/test_methods.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ use pyo3::types::{IntoPyDict, PyDict, PyList, PySet, PyString, PyTuple, PyType};
1010
use pyo3::BoundObject;
1111
use pyo3_macros::pyclass;
1212

13+
use crate::test_utils::CatchWarnings;
14+
1315
mod test_utils;
1416

1517
#[pyclass]
@@ -1288,7 +1290,7 @@ fn test_pymethods_warn() {
12881290

12891291
Python::attach(|py| {
12901292
let typeobj = py.get_type::<WarningMethodContainer>();
1291-
let obj = typeobj.call0().unwrap();
1293+
let obj = CatchWarnings::enter(py, |_| typeobj.call0()).unwrap();
12921294

12931295
// FnType::Fn
12941296
py_expect_warning!(

0 commit comments

Comments
 (0)