2222import psycopg
2323import pytest
2424from psycopg import AsyncConnection , Connection
25- from pytest import FixtureRequest
2625
2726from pytest_postgresql ._asyncio_compat import mark_postgresql_async_fixture , supports_loop_factories
2827from pytest_postgresql .config import get_config
3736pytest_asyncio = _pytest_asyncio
3837
3938
40- def _postgresql_async_unavailable_stub () -> Callable [[FixtureRequest ], AsyncIterator [AsyncConnection ]]:
39+ def _postgresql_async_unavailable_stub () -> Callable [[pytest . FixtureRequest ], AsyncIterator [AsyncConnection ]]:
4140 """Return a sync fixture stub that raises when pytest-asyncio is missing or too old."""
4241
4342 @pytest .fixture
44- def postgresql_async_stub (request : FixtureRequest ) -> None :
43+ def postgresql_async_stub (request : pytest . FixtureRequest ) -> None :
4544 """Sync stub that raises ImportError when pytest-asyncio is absent or too old."""
4645 raise ImportError (
4746 "pytest-asyncio >= 1.4 is required for async fixtures. "
@@ -50,7 +49,7 @@ def postgresql_async_stub(request: FixtureRequest) -> None:
5049
5150 mark_postgresql_async_fixture (postgresql_async_stub )
5251 return cast (
53- Callable [[FixtureRequest ], AsyncIterator [AsyncConnection ]],
52+ Callable [[pytest . FixtureRequest ], AsyncIterator [AsyncConnection ]],
5453 postgresql_async_stub ,
5554 )
5655
@@ -59,7 +58,7 @@ def postgresql(
5958 process_fixture_name : str ,
6059 dbname : str | None = None ,
6160 isolation_level : "psycopg.IsolationLevel | None" = None ,
62- ) -> Callable [[FixtureRequest ], Iterator [Connection ]]:
61+ ) -> Callable [[pytest . FixtureRequest ], Iterator [Connection ]]:
6362 """Return connection fixture factory for PostgreSQL.
6463
6564 :param process_fixture_name: name of the process fixture
@@ -70,7 +69,7 @@ def postgresql(
7069 """
7170
7271 @pytest .fixture
73- def postgresql_factory (request : FixtureRequest ) -> Iterator [Connection ]:
72+ def postgresql_factory (request : pytest . FixtureRequest ) -> Iterator [Connection ]:
7473 """Fixture connection factory for PostgreSQL.
7574
7675 :param request: fixture request object
@@ -120,7 +119,7 @@ def postgresql_async(
120119 process_fixture_name : str ,
121120 dbname : str | None = None ,
122121 isolation_level : "psycopg.IsolationLevel | None" = None ,
123- ) -> Callable [[FixtureRequest ], AsyncIterator [AsyncConnection ]]:
122+ ) -> Callable [[pytest . FixtureRequest ], AsyncIterator [AsyncConnection ]]:
124123 """Return async connection fixture factory for PostgreSQL.
125124
126125 Requires ``pytest-asyncio`` >= 1.4 (install via ``pip install pytest-postgresql[async]``).
@@ -135,7 +134,7 @@ def postgresql_async(
135134 return _postgresql_async_unavailable_stub ()
136135
137136 @pytest_asyncio .fixture
138- async def postgresql_async_factory (request : FixtureRequest ) -> AsyncIterator [AsyncConnection ]:
137+ async def postgresql_async_factory (request : pytest . FixtureRequest ) -> AsyncIterator [AsyncConnection ]:
139138 """Async connection fixture factory for PostgreSQL.
140139
141140 :param request: fixture request object
@@ -180,6 +179,6 @@ async def postgresql_async_factory(request: FixtureRequest) -> AsyncIterator[Asy
180179
181180 mark_postgresql_async_fixture (postgresql_async_factory )
182181 return cast (
183- Callable [[FixtureRequest ], AsyncIterator [AsyncConnection ]],
182+ Callable [[pytest . FixtureRequest ], AsyncIterator [AsyncConnection ]],
184183 postgresql_async_factory ,
185184 )
0 commit comments