Because of https://bugs.python.org/issue42600 or thereabout.
# Copyright (C) 2021 The Psycopg Team
+import sys
import asyncio
import logging
from abc import ABC, abstractmethod
from weakref import ref
from collections import deque
+from .. import errors as e
from ..pq import TransactionStatus
from ..connection import AsyncConnection
from ..utils.compat import asynccontextmanager, create_task
] = None,
**kwargs: Any,
):
+ # https://bugs.python.org/issue42600
+ if sys.version_info < (3, 7):
+ raise e.NotSupportedError(
+ "async pool not supported before Python 3.7"
+ )
+
self._configure = configure
self._lock = asyncio.Lock()
+import sys
import logging
import weakref
from time import sleep, time
assert pid not in pids2
+@pytest.mark.skipif(
+ sys.version_info >= (3, 7), reason="async pool supported from Python 3.7"
+)
+def test_async_pool_not_supported(dsn):
+ # note: this test is here because the all the ones in test_pool_async are
+ # skipped on Py 3.6
+ with pytest.raises(psycopg3.NotSupportedError):
+ pool.AsyncConnectionPool(dsn)
+
+
def delay_connection(monkeypatch, sec):
"""
Return a _connect_gen function delayed by the amount of seconds
+import sys
import asyncio
import logging
import weakref
from psycopg3.pq import TransactionStatus
from psycopg3.utils.compat import create_task
-pytestmark = pytest.mark.asyncio
+pytestmark = [
+ pytest.mark.asyncio,
+ pytest.mark.skipif(
+ sys.version_info < (3, 7),
+ reason="async pool not supported before Python 3.7",
+ ),
+]
async def test_defaults(dsn):