|
1 | 1 | from __future__ import annotations
|
2 | 2 |
|
3 | 3 | from collections.abc import AsyncIterator, Awaitable
|
4 |
| -from typing import Any, Callable, ParamSpec, TypeVar, Union |
| 4 | +from typing import TYPE_CHECKING |
5 | 5 |
|
6 | 6 | import pytest
|
7 | 7 |
|
8 | 8 | from pytest_django_test.app.models import Item
|
9 | 9 |
|
10 | 10 |
|
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] |
14 | 17 |
|
15 | 18 | try:
|
16 | 19 | import pytest_asyncio
|
17 | 20 | 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 |
19 | 22 | "pytest-asyncio is not installed"
|
20 | 23 | )
|
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 |
22 | 25 | "pytest-asyncio is not installed"
|
23 | 26 | )
|
24 | 27 |
|
|
0 commit comments