Skip to content

Commit 3515460

Browse files
author
Lode Rosseel
committed
Move paramspec into type check block for python 3.9
1 parent 3ee56c4 commit 3515460

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tests/test_async_db.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
from __future__ import annotations
22

33
from collections.abc import AsyncIterator, Awaitable
4-
from typing import Any, Callable, ParamSpec, TypeVar, Union
4+
from typing import TYPE_CHECKING
55

66
import pytest
77

88
from pytest_django_test.app.models import Item
99

1010

11-
_R = TypeVar("_R", bound=Union[Awaitable[Any], AsyncIterator[Any]])
12-
_P = ParamSpec("_P")
13-
FixtureFunction = Callable[_P, _R]
11+
if TYPE_CHECKING:
12+
from typing import Any, Callable, ParamSpec, TypeVar, Union
13+
14+
_R = TypeVar("_R", bound=Union[Awaitable[Any], AsyncIterator[Any]])
15+
_P = ParamSpec("_P")
16+
FixtureFunction = Callable[_P, _R]
1417

1518
try:
1619
import pytest_asyncio
1720
except ImportError:
18-
pytestmark: Callable[[FixtureFunction[_P, _R]], FixtureFunction[_P, _R]] = pytest.mark.skip(
21+
pytestmark: "Callable[[FixtureFunction[_P, _R]], FixtureFunction[_P, _R]]" = pytest.mark.skip( # noqa: UP037
1922
"pytest-asyncio is not installed"
2023
)
21-
fixturemark: Callable[[FixtureFunction[_P, _R]], FixtureFunction[_P, _R]] = pytest.mark.skip(
24+
fixturemark: "Callable[[FixtureFunction[_P, _R]], FixtureFunction[_P, _R]]" = pytest.mark.skip( # noqa: UP037
2225
"pytest-asyncio is not installed"
2326
)
2427

0 commit comments

Comments
 (0)