Browse Source

Try to fix reentrant write transient failures in tests (#5447)

* Disable print_destroyed in tests on GraalPy

* Reenable test_iostream on GraalPy
pull/5451/head
Michael Šimáček 8 months ago committed by GitHub
parent
commit
83b92ceb35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      tests/constructor_stats.h
  2. 6
      tests/test_iostream.py

8
tests/constructor_stats.h

@ -312,8 +312,16 @@ void print_created(T *inst, Values &&...values) { @@ -312,8 +312,16 @@ void print_created(T *inst, Values &&...values) {
}
template <class T, typename... Values>
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 <class T, typename... Values>
void print_values(T *inst, Values &&...values) {

6
tests/test_iostream.py

@ -6,14 +6,8 @@ from io import StringIO @@ -6,14 +6,8 @@ from io import StringIO
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!"

Loading…
Cancel
Save