Skip to content

Commit cfd222e

Browse files
authored
Skip GC-dependent tests on GraalPy (#5401)
1 parent 98ec25c commit cfd222e

3 files changed

+11
-3
lines changed

tests/test_class_sh_property.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
pytest.skip("smart_holder not available.", allow_module_level=True)
1212

1313

14-
@pytest.mark.xfail("env.PYPY", reason="gc after `del field` is apparently deferred")
14+
@pytest.mark.skipif(
15+
"env.PYPY or env.GRAALPY", reason="gc after `del field` is apparently deferred"
16+
)
1517
@pytest.mark.parametrize("m_attr", ["m_valu_readonly", "m_valu_readwrite"])
1618
def test_valu_getter(m_attr):
1719
# Reduced from PyCLIF test:

tests/test_class_sh_trampoline_shared_from_this.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ def test_multiple_registered_instances_for_same_pointee_recursive():
212212
del obj_next
213213
assert obj.history == "PySft"
214214
del obj0
215-
if not env.PYPY:
215+
if not env.PYPY and not env.GRAALPY:
216216
assert obj0_wr() is not None
217217
del obj # This releases the chain recursively.
218-
if not env.PYPY:
218+
if not env.PYPY and not env.GRAALPY:
219219
assert obj0_wr() is None
220220
break # Comment out for manual leak checking (use `top` command).
221221

tests/test_class_sh_trampoline_shared_ptr_cpp_arg.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
import pytest
44

5+
import env # noqa: F401
56
import pybind11_tests.class_sh_trampoline_shared_ptr_cpp_arg as m
67

78
if not m.defined_PYBIND11_SMART_HOLDER_ENABLED:
89
pytest.skip("smart_holder not available.", allow_module_level=True)
910

1011

12+
@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
1113
def test_shared_ptr_cpp_arg():
1214
import weakref
1315

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

3436

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

5255

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

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

7074

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

@@ -110,6 +115,7 @@ def test_shared_ptr_alias_nonpython():
110115
assert new_tester.has_python_instance() is False
111116

112117

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

0 commit comments

Comments
 (0)