Skip to content

Commit 34c0d4f

Browse files
committed
fixup: attempt to stabilise tests
1 parent 4cce0bf commit 34c0d4f

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

pytest_postgresql/factories/client.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
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

2223
import psycopg
2324
import 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

0 commit comments

Comments
 (0)