From 2096144e143d0ac4f61e0c55fa49307938265cdd Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Mon, 2 Mar 2026 15:03:19 +0000 Subject: [PATCH 1/4] Re-enable Android tests in CIBW workflow --- .github/workflows/tests-cibw.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index 5dfb5dc940..627ccc497e 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -70,14 +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') From ec3bba1540b7174809e2e08362f3871ebd3f2128 Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Mon, 2 Mar 2026 15:59:50 +0000 Subject: [PATCH 2/4] Skip subprocess tests on Android --- tests/env.py | 5 +++++ tests/test_custom_type_setup.py | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/env.py b/tests/env.py index 790a0108fc..12acde7b3a 100644 --- a/tests/env.py +++ b/tests/env.py @@ -4,6 +4,8 @@ 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 diff --git a/tests/test_custom_type_setup.py b/tests/test_custom_type_setup.py index 4c6b9510ae..a200b02b5a 100644 --- a/tests/test_custom_type_setup.py +++ b/tests/test_custom_type_setup.py @@ -2,7 +2,6 @@ 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. From 26a85bbb28c94cda46058f88f4718b761fcbcb8e Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Mon, 2 Mar 2026 18:56:48 +0000 Subject: [PATCH 3/4] Remove Android workarounds no longer necessary with current cibuildwheel version --- .github/workflows/tests-cibw.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index 627ccc497e..bf534316af 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -70,16 +70,6 @@ jobs: if: contains(matrix.runs-on, 'macos') run: echo "CIBW_TEST_COMMAND=" >> "$GITHUB_ENV" - # 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 From de37f41013acf945b8d04931eda66565eba67df0 Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Mon, 2 Mar 2026 18:57:32 +0000 Subject: [PATCH 4/4] Skip more subprocess tests on Android --- tests/test_gil_scoped.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_gil_scoped.py b/tests/test_gil_scoped.py index 84a7a999ab..fc998b0ed2 100644 --- a/tests/test_gil_scoped.py +++ b/tests/test_gil_scoped.py @@ -168,6 +168,9 @@ def _intentional_deadlock(): 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