Skip to content

Commit be5ff4a

Browse files
authored
.
1 parent d5944eb commit be5ff4a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pytest_django/fixtures.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
_DjangoDbAvailableApps = Optional[List[str]]
3939
# transaction, reset_sequences, databases, serialized_rollback, available_apps
4040
_DjangoDb = Tuple[bool, bool, _DjangoDbDatabases, bool, _DjangoDbAvailableApps]
41+
_QueriesContext = TypeVar("T", CaptureQueriesContext, CaptureAllConnectionsQueriesContext)
4142

4243

4344
__all__ = [
@@ -648,7 +649,7 @@ def __call__(
648649
*,
649650
using: str | None = ...,
650651
) -> django.test.utils.CaptureQueriesContext:
651-
pass # pragma: no cover
652+
...
652653

653654

654655
class DjangoAssertNumAllConnectionsQueries(Protocol):
@@ -660,7 +661,7 @@ def __call__(
660661
num: int,
661662
info: str | None = ...,
662663
) -> CaptureAllConnectionsQueriesContext:
663-
pass # pragma: no cover
664+
...
664665

665666

666667
@contextmanager
@@ -710,13 +711,11 @@ def _assert_num_queries_all_db(
710711
def _assert_num_queries_context(
711712
*,
712713
config: pytest.Config,
713-
context: django.test.utils.CaptureQueriesContext | CaptureAllConnectionsQueriesContext,
714+
context: _QueriesContext,
714715
num: int,
715716
exact: bool = True,
716717
info: str | None = None,
717-
) -> Generator[
718-
django.test.utils.CaptureQueriesContext | CaptureAllConnectionsQueriesContext, None, None
719-
]:
718+
) -> Generator[_QueriesContext]:
720719
verbose = config.getoption("verbose") > 0
721720
with context:
722721
yield context

0 commit comments

Comments
 (0)