Skip to content

Commit 9047da6

Browse files
committed
Some type annotations
1 parent 9fcdf5f commit 9047da6

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

pytest_django/django_compat.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Note that all functions here assume django is available. So ensure
22
# this is the case before you call them.
3+
from __future__ import annotations
34

5+
import pytest
46

5-
def is_django_unittest(request_or_item) -> bool:
6-
"""Returns True if the request_or_item is a Django test case, otherwise False"""
7+
8+
def is_django_unittest(request_or_item: pytest.FixtureRequest | pytest.Item) -> bool:
9+
"""Returns whether the request or item is a Django test case."""
710
from django.test import SimpleTestCase
811

912
cls = getattr(request_or_item, "cls", None)

pytest_django/fixtures.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,11 +598,11 @@ def _live_server_helper(request: pytest.FixtureRequest) -> Generator[None, None,
598598

599599
@contextmanager
600600
def _assert_num_queries(
601-
config,
601+
config: pytest.Config,
602602
num: int,
603603
exact: bool = True,
604604
connection=None,
605-
info=None,
605+
info: str | None = None,
606606
) -> Generator[django.test.utils.CaptureQueriesContext, None, None]:
607607
from django.test.utils import CaptureQueriesContext
608608

@@ -636,12 +636,12 @@ def _assert_num_queries(
636636

637637

638638
@pytest.fixture()
639-
def django_assert_num_queries(pytestconfig):
639+
def django_assert_num_queries(pytestconfig: pytest.Config):
640640
return partial(_assert_num_queries, pytestconfig)
641641

642642

643643
@pytest.fixture()
644-
def django_assert_max_num_queries(pytestconfig):
644+
def django_assert_max_num_queries(pytestconfig: pytest.Config):
645645
return partial(_assert_num_queries, pytestconfig, exact=False)
646646

647647

0 commit comments

Comments
 (0)