Skip GC-dependent tests on GraalPy (#5401)

This commit is contained in:
Michael Šimáček 2024-10-08 19:44:24 +02:00 committed by GitHub
parent 98ec25c6af
commit cfd222ebdf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 3 deletions

View File

@ -11,7 +11,9 @@ if not m.defined_PYBIND11_SMART_HOLDER_ENABLED:
pytest.skip("smart_holder not available.", allow_module_level=True) pytest.skip("smart_holder not available.", allow_module_level=True)
@pytest.mark.xfail("env.PYPY", reason="gc after `del field` is apparently deferred") @pytest.mark.skipif(
"env.PYPY or env.GRAALPY", reason="gc after `del field` is apparently deferred"
)
@pytest.mark.parametrize("m_attr", ["m_valu_readonly", "m_valu_readwrite"]) @pytest.mark.parametrize("m_attr", ["m_valu_readonly", "m_valu_readwrite"])
def test_valu_getter(m_attr): def test_valu_getter(m_attr):
# Reduced from PyCLIF test: # Reduced from PyCLIF test:

View File

@ -212,10 +212,10 @@ def test_multiple_registered_instances_for_same_pointee_recursive():
del obj_next del obj_next
assert obj.history == "PySft" assert obj.history == "PySft"
del obj0 del obj0
if not env.PYPY: if not env.PYPY and not env.GRAALPY:
assert obj0_wr() is not None assert obj0_wr() is not None
del obj # This releases the chain recursively. del obj # This releases the chain recursively.
if not env.PYPY: if not env.PYPY and not env.GRAALPY:
assert obj0_wr() is None assert obj0_wr() is None
break # Comment out for manual leak checking (use `top` command). break # Comment out for manual leak checking (use `top` command).

View File

@ -2,12 +2,14 @@ from __future__ import annotations
import pytest import pytest
import env # noqa: F401
import pybind11_tests.class_sh_trampoline_shared_ptr_cpp_arg as m import pybind11_tests.class_sh_trampoline_shared_ptr_cpp_arg as m
if not m.defined_PYBIND11_SMART_HOLDER_ENABLED: if not m.defined_PYBIND11_SMART_HOLDER_ENABLED:
pytest.skip("smart_holder not available.", allow_module_level=True) pytest.skip("smart_holder not available.", allow_module_level=True)
@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
def test_shared_ptr_cpp_arg(): def test_shared_ptr_cpp_arg():
import weakref import weakref
@ -32,6 +34,7 @@ def test_shared_ptr_cpp_arg():
assert tester.get_object() is objref() assert tester.get_object() is objref()
@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
def test_shared_ptr_cpp_prop(): def test_shared_ptr_cpp_prop():
class PyChild(m.SpBase): class PyChild(m.SpBase):
def is_base_used(self): def is_base_used(self):
@ -50,6 +53,7 @@ def test_shared_ptr_cpp_prop():
assert tester.obj.has_python_instance() is True assert tester.obj.has_python_instance() is True
@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
def test_shared_ptr_arg_identity(): def test_shared_ptr_arg_identity():
import weakref import weakref
@ -68,6 +72,7 @@ def test_shared_ptr_arg_identity():
assert tester.has_python_instance() is False assert tester.has_python_instance() is False
@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
def test_shared_ptr_alias_nonpython(): def test_shared_ptr_alias_nonpython():
tester = m.SpBaseTester() tester = m.SpBaseTester()
@ -110,6 +115,7 @@ def test_shared_ptr_alias_nonpython():
assert new_tester.has_python_instance() is False assert new_tester.has_python_instance() is False
@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
def test_shared_ptr_goaway(): def test_shared_ptr_goaway():
import weakref import weakref