From ca75c122d97f15dc27224af3a027a61c073f1050 Mon Sep 17 00:00:00 2001 From: Michael Simacek Date: Mon, 18 Nov 2024 22:53:54 +0100 Subject: [PATCH 1/2] Disable print_destroyed in tests on GraalPy --- tests/constructor_stats.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/constructor_stats.h b/tests/constructor_stats.h index 9a5754fed9..352b1b6ca5 100644 --- a/tests/constructor_stats.h +++ b/tests/constructor_stats.h @@ -312,8 +312,16 @@ void print_created(T *inst, Values &&...values) { } template void print_destroyed(T *inst, Values &&...values) { // Prints but doesn't store given values + /* + * On GraalPy, destructors can trigger anywhere and this can cause random + * failures in unrelated tests. + */ +#if !defined(GRAALVM_PYTHON) print_constr_details(inst, "destroyed", values...); track_destroyed(inst); +#else + py::detail::silence_unused_warnings(inst, values...); +#endif } template void print_values(T *inst, Values &&...values) { From 1f3dc213b91d19a78a9d9a3aca37cb995ec589b8 Mon Sep 17 00:00:00 2001 From: Michael Simacek Date: Mon, 18 Nov 2024 22:54:14 +0100 Subject: [PATCH 2/2] Reenable test_iostream on GraalPy --- tests/test_iostream.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/test_iostream.py b/tests/test_iostream.py index 606028d6fe..c3d987787a 100644 --- a/tests/test_iostream.py +++ b/tests/test_iostream.py @@ -6,14 +6,8 @@ import pytest -import env # noqa: F401 from pybind11_tests import iostream as m -pytestmark = pytest.mark.skipif( - "env.GRAALPY", - reason="Delayed prints from finalizers from other tests can end up in the output", -) - def test_captured(capsys): msg = "I've been redirected to Python, I hope!"