Add support for GraalPy (#5380)

* Initial support for GraalPy

* Mark tests that currently fail on GraalPy with xfail

* Add graalpy to CI

* Limit test deps on graalpy to available binary wheels

* Skip cmake test installed_function on GraalPy

CMake won't find libpython on GraalPy, it either fails or silently picks
CPython's libpython.

* Factor out setting function docstrings into a macro

* Try to narrow down skipped tests
This commit is contained in:
Michael Šimáček
2024-10-07 23:12:04 +02:00
committed by GitHub
parent 7e418f4924
commit c4a05f9344
42 changed files with 211 additions and 66 deletions

View File

@@ -4,7 +4,7 @@ import sys
import pytest
import env # noqa: F401
import env
from pybind11_tests import ConstructorStats
from pybind11_tests import methods_and_attributes as m
@@ -68,6 +68,9 @@ def test_methods_and_attributes():
instance1.value = 100
assert str(instance1) == "ExampleMandA[value=100]"
if env.GRAALPY:
pytest.skip("ConstructorStats is incompatible with GraalPy.")
cstats = ConstructorStats.get(m.ExampleMandA)
assert cstats.alive() == 2
del instance1, instance2
@@ -316,6 +319,8 @@ def test_dynamic_attributes():
instance.__dict__ = []
assert str(excinfo.value) == "__dict__ must be set to a dictionary, not a 'list'"
if env.GRAALPY:
pytest.skip("ConstructorStats is incompatible with GraalPy.")
cstats = ConstructorStats.get(m.DynamicClass)
assert cstats.alive() == 1
del instance
@@ -337,6 +342,7 @@ def test_dynamic_attributes():
# https://foss.heptapod.net/pypy/pypy/-/issues/2447
@pytest.mark.xfail("env.PYPY")
@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
def test_cyclic_gc():
# One object references itself
instance = m.DynamicClass()