from typing import TYPE_CHECKING, Any
from collections import Counter, deque
-from psycopg import errors as e
-
from .errors import PoolClosed
if TYPE_CHECKING:
def _check_open(self) -> None:
if self._closed and self._opened:
- raise e.OperationalError(
- "pool has already been opened/closed and cannot be reused"
- )
+ raise PoolClosed("pool has already been opened/closed and cannot be reused")
def _check_open_getconn(self) -> None:
if self._closed:
assert p._sched_runner is None
assert not p._workers
- with pytest.raises(psycopg.OperationalError, match="cannot be reused"):
+ with pytest.raises(pool.PoolClosed, match="cannot be reused"):
p.open()
assert p._sched_runner is None
assert not p._workers
- with pytest.raises(psycopg.OperationalError, match="cannot be reused"):
+ with pytest.raises(pool.PoolClosed, match="cannot be reused"):
await p.open()