mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
Re-enable Android tests in CIBW workflow (#6001)
* Re-enable Android tests in CIBW workflow * Skip subprocess tests on Android * Remove Android workarounds no longer necessary with current cibuildwheel version * Skip more subprocess tests on Android
This commit is contained in:
18
.github/workflows/tests-cibw.yml
vendored
18
.github/workflows/tests-cibw.yml
vendored
@@ -70,24 +70,6 @@ jobs:
|
||||
if: contains(matrix.runs-on, 'macos')
|
||||
run: echo "CIBW_TEST_COMMAND=" >> "$GITHUB_ENV"
|
||||
|
||||
# Temporarily disable Android tests on ubuntu-latest due to emulator issues.
|
||||
# See https://github.com/pybind/pybind11/pull/5914.
|
||||
- name: "NOTE: Android tests are disabled on ubuntu-latest"
|
||||
if: contains(matrix.runs-on, 'ubuntu')
|
||||
run: |
|
||||
echo "CIBW_TEST_COMMAND=" >> "$GITHUB_ENV"
|
||||
echo '::warning::Android cibuildwheel tests are disabled on ubuntu-latest (CIBW_TEST_COMMAND is empty). See PR 5914.'
|
||||
|
||||
# https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/
|
||||
- name: Enable KVM for Android emulator
|
||||
if: contains(matrix.runs-on, 'ubuntu')
|
||||
run: |
|
||||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger --name-match=kvm
|
||||
|
||||
- run: pipx install patchelf
|
||||
|
||||
- uses: pypa/cibuildwheel@v3.3
|
||||
env:
|
||||
CIBW_PLATFORM: android
|
||||
|
||||
@@ -4,6 +4,8 @@ import platform
|
||||
import sys
|
||||
import sysconfig
|
||||
|
||||
import pytest
|
||||
|
||||
ANDROID = sys.platform.startswith("android")
|
||||
IOS = sys.platform.startswith("ios")
|
||||
LINUX = sys.platform.startswith("linux")
|
||||
@@ -50,6 +52,9 @@ def check_script_success_in_subprocess(code: str, *, rerun: int = 8) -> None:
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
if ANDROID or IOS or sys.platform.startswith("emscripten"):
|
||||
pytest.skip("Requires subprocess support")
|
||||
|
||||
code = textwrap.dedent(code).strip()
|
||||
try:
|
||||
for _ in range(rerun): # run flakily failing test multiple times
|
||||
|
||||
@@ -2,7 +2,6 @@ from __future__ import annotations
|
||||
|
||||
import gc
|
||||
import os
|
||||
import sys
|
||||
import weakref
|
||||
|
||||
import pytest
|
||||
@@ -52,10 +51,6 @@ def test_indirect_cycle(gc_tester):
|
||||
gc_tester(obj)
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
env.IOS or sys.platform.startswith("emscripten"),
|
||||
reason="Requires subprocess support",
|
||||
)
|
||||
@pytest.mark.skipif("env.PYPY or env.GRAALPY")
|
||||
def test_py_cast_useable_on_shutdown():
|
||||
"""Test that py::cast works during interpreter shutdown.
|
||||
|
||||
@@ -168,6 +168,9 @@ ALL_BASIC_TESTS_PLUS_INTENTIONAL_DEADLOCK = (*ALL_BASIC_TESTS, _intentional_dead
|
||||
|
||||
|
||||
def _run_in_process(target, *args, **kwargs):
|
||||
if env.ANDROID or env.IOS or sys.platform.startswith("emscripten"):
|
||||
pytest.skip("Requires subprocess support")
|
||||
|
||||
test_fn = target if len(args) == 0 else args[0]
|
||||
# Do not need to wait much, 10s should be more than enough.
|
||||
timeout = 0.1 if test_fn is _intentional_deadlock else 10
|
||||
|
||||
Reference in New Issue
Block a user