]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
test: skip some tests that raise an error on pypy 3.9
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 2 Dec 2023 01:56:35 +0000 (02:56 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 2 Dec 2023 02:01:28 +0000 (03:01 +0100)
The error is:

    anyio/_backends/_asyncio.py:2039: in _cancel_all_tasks
        raise cast(BaseException, task.exception())
    ...
    >               result = coro.throw(exc)
    E               RuntimeError: can't do async_generator.athrow().throw()

The error only happens on Pypy 3.9, and doesn't happen on master, only
in the maint 3.1 branch. 3.1 uses anyio < 4, master uses anyio >= 4, so
I would say that the error is limited to only this combination and that
it is an anyio bug.

The problem affects just two tests, so let's just skip them. Whatever.

tests/test_connection_async.py

index 17ecbe3d641fab0917be09733ba41c9e851559f1..b71d58bcc120b7c81fc83ef868162e7dc61de40c 100644 (file)
@@ -1,3 +1,4 @@
+import sys
 import time
 import pytest
 import logging
@@ -18,6 +19,11 @@ from .test_conninfo import fake_resolve  # noqa: F401
 
 pytestmark = pytest.mark.anyio
 
+anyio_3_runtime_error = pytest.mark.skipif(
+    sys.version_info < (3, 10) and sys.implementation.name == "pypy",
+    reason="anyio 3 runtime error",
+)
+
 
 async def test_connect(aconn_cls, dsn):
     conn = await aconn_cls.connect(dsn)
@@ -125,6 +131,7 @@ async def test_cursor_closed(aconn):
         aconn.cursor()
 
 
+@anyio_3_runtime_error
 async def test_connection_warn_close(aconn_cls, dsn, recwarn, gc_collect):
     conn = await aconn_cls.connect(dsn)
     await conn.close()
@@ -233,6 +240,7 @@ async def test_context_active_rollback_no_clobber(aconn_cls, dsn, caplog):
 
 
 @pytest.mark.slow
+@anyio_3_runtime_error
 async def test_weakref(aconn_cls, dsn, gc_collect):
     conn = await aconn_cls.connect(dsn)
     w = weakref.ref(conn)