From f10cd09808aa6aec9a24211b8926cbe9b870fc65 Mon Sep 17 00:00:00 2001 From: Ihor Kalnytskyi Date: Sun, 17 Nov 2024 20:37:39 +0200 Subject: [PATCH] Skip ASGI websocket tests on PyPy When running on PyPy, the ASGI websocket tests sometimes hang. This is especially annoying on CI/CD. Most likely the issue lies either in the Starlette's TestClient implementation, or anyio it delegates to process the request in a background thread. For a time being, it's better to skip them for good. --- .github/workflows/ci.yml | 4 ---- tests/ext/test_asgiscopes.py | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96e57ee..8c8f36a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,10 +35,6 @@ jobs: matrix: os: [ubuntu-latest, macos-latest] python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"] - exclude: - # The job hangs for some reason during tests execution. :( - - os: macos-latest - python-version: pypy-3.10 runs-on: ${{ matrix.os }} steps: diff --git a/tests/ext/test_asgiscopes.py b/tests/ext/test_asgiscopes.py index 16bd5f8..fb5084d 100644 --- a/tests/ext/test_asgiscopes.py +++ b/tests/ext/test_asgiscopes.py @@ -1,6 +1,7 @@ """Test ASGI scopes.""" import asyncio +import sys import async_asgi_testclient import pytest @@ -98,6 +99,9 @@ async def endpoint_ws(websocket, func=func): def client_factory(connection_type): """A factory that creates synchronous test client instances.""" + if connection_type == "websocket" and sys.implementation.name == "pypy": + pytest.skip("When running on PyPy, the websocket tests sometimes hang.") + def factory(app): return ClientFacade(app, connection_type)