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
m = pytest.importorskip("pybind11_tests.virtual_functions")
from pybind11_tests import ConstructorStats # noqa: E402
@@ -82,6 +82,9 @@ def test_override(capture, msg):
"""
)
if env.GRAALPY:
pytest.skip("ConstructorStats is incompatible with GraalPy.")
cstats = ConstructorStats.get(m.ExampleVirt)
assert cstats.alive() == 3
del ex12, ex12p, ex12p2
@@ -91,6 +94,7 @@ def test_override(capture, msg):
assert cstats.move_constructions >= 0
@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
def test_alias_delay_initialization1(capture):
"""`A` only initializes its trampoline class when we inherit from it
@@ -130,6 +134,7 @@ def test_alias_delay_initialization1(capture):
)
@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
def test_alias_delay_initialization2(capture):
"""`A2`, unlike the above, is configured to always initialize the alias
@@ -188,7 +193,7 @@ def test_alias_delay_initialization2(capture):
# PyPy: Reference count > 1 causes call with noncopyable instance
# to fail in ncv1.print_nc()
@pytest.mark.xfail("env.PYPY")
@pytest.mark.xfail("env.PYPY or env.GRAALPY")
@pytest.mark.skipif(
not hasattr(m, "NCVirt"), reason="NCVirt does not work on Intel/PGI/NVCC compilers"
)