File tree Expand file tree Collapse file tree
pytest_postgresql/factories Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717# along with pytest-postgresql. If not, see <http://www.gnu.org/licenses/>.
1818"""Fixture factory for postgresql client."""
1919
20- from typing import Callable , Iterator
20+ import inspect
21+ from typing import Any , Callable , Iterator
2122
2223import psycopg
2324import pytest
@@ -45,7 +46,7 @@ def postgresql(
4546 """
4647
4748 @pytest .fixture
48- def postgresql_factory (request : FixtureRequest ) -> Iterator [Connection ]:
49+ def postgresql_factory (request : FixtureRequest , ** kwargs : Any ) -> Iterator [Connection ]:
4950 """Fixture factory for PostgreSQL.
5051
5152 :param request: fixture request object
@@ -84,4 +85,11 @@ def postgresql_factory(request: FixtureRequest) -> Iterator[Connection]:
8485 yield db_connection
8586 db_connection .close ()
8687
88+ # Expose process fixture dependency to pytest for correct teardown ordering.
89+ postgresql_factory .__signature__ = inspect .Signature ( # type: ignore[attr-defined]
90+ parameters = [
91+ inspect .Parameter ("request" , inspect .Parameter .POSITIONAL_OR_KEYWORD ),
92+ inspect .Parameter (process_fixture_name , inspect .Parameter .POSITIONAL_OR_KEYWORD ),
93+ ]
94+ )
8795 return postgresql_factory
You can’t perform that action at this time.
0 commit comments