Skip to content

Commit

Permalink
Skip GC-dependent tests on GraalPy (#5401)
Browse files Browse the repository at this point in the history
  • Loading branch information
msimacek authored Oct 8, 2024
1 parent 98ec25c commit cfd222e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion tests/test_class_sh_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
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"])
def test_valu_getter(m_attr):
# Reduced from PyCLIF test:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_class_sh_trampoline_shared_from_this.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ def test_multiple_registered_instances_for_same_pointee_recursive():
del obj_next
assert obj.history == "PySft"
del obj0
if not env.PYPY:
if not env.PYPY and not env.GRAALPY:
assert obj0_wr() is not None
del obj # This releases the chain recursively.
if not env.PYPY:
if not env.PYPY and not env.GRAALPY:
assert obj0_wr() is None
break # Comment out for manual leak checking (use `top` command).

Expand Down
6 changes: 6 additions & 0 deletions tests/test_class_sh_trampoline_shared_ptr_cpp_arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import pytest

import env # noqa: F401
import pybind11_tests.class_sh_trampoline_shared_ptr_cpp_arg as m

if not m.defined_PYBIND11_SMART_HOLDER_ENABLED:
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():
import weakref

Expand All @@ -32,6 +34,7 @@ def is_base_used(self):
assert tester.get_object() is objref()


@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
def test_shared_ptr_cpp_prop():
class PyChild(m.SpBase):
def is_base_used(self):
Expand All @@ -50,6 +53,7 @@ def is_base_used(self):
assert tester.obj.has_python_instance() is True


@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
def test_shared_ptr_arg_identity():
import weakref

Expand All @@ -68,6 +72,7 @@ def test_shared_ptr_arg_identity():
assert tester.has_python_instance() is False


@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
def test_shared_ptr_alias_nonpython():
tester = m.SpBaseTester()

Expand Down Expand Up @@ -110,6 +115,7 @@ def test_shared_ptr_alias_nonpython():
assert new_tester.has_python_instance() is False


@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
def test_shared_ptr_goaway():
import weakref

Expand Down

0 comments on commit cfd222e

Please sign in to comment.