Skip to content

Commit 03e273b

Browse files
committed
Ignore deprecationwarnings in tests
1 parent 535a5fc commit 03e273b

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/duckdb_py/pyrelation/initialize.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,10 @@ static void InitializeConsumers(py::class_<DuckDBPyRelation> &m) {
8585
.def("record_batch",
8686
[](pybind11::object &self, idx_t rows_per_batch)
8787
{
88-
auto warnings = pybind11::module::import("warnings");
89-
auto builtins = pybind11::module::import("builtins");
90-
warnings.attr("warn")(
91-
"record_batch() is deprecated, use fetch_record_batch() instead.",
92-
builtins.attr("DeprecationWarning"));
93-
94-
return self.attr("fetch_record_batch")(rows_per_batch);
88+
PyErr_WarnEx(PyExc_DeprecationWarning,
89+
"record_batch() is deprecated, use fetch_record_batch() instead.",
90+
0);
91+
return self.attr("fetch_record_batch")(rows_per_batch);
9592
}, py::arg("rows_per_batch") = 1000000);
9693
}
9794

tests/pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
filterwarnings =
44
error
55
ignore::UserWarning
6+
ignore::DeprecationWarning
67
# Jupyter is throwing DeprecationWarnings
78
ignore:function ham\(\) is deprecated:DeprecationWarning
89
# Pyspark is throwing these warnings

0 commit comments

Comments
 (0)