File: conftest.py

package info (click to toggle)
starlette 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,104 kB
  • sloc: python: 13,266; sh: 35; javascript: 32; makefile: 6
file content (23 lines) | stat: -rw-r--r-- 617 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from __future__ import annotations

import functools
from typing import Any, Literal

import pytest

from starlette.testclient import TestClient
from tests.types import TestClientFactory


@pytest.fixture
def test_client_factory(
    anyio_backend_name: Literal["asyncio", "trio"],
    anyio_backend_options: dict[str, Any],
) -> TestClientFactory:
    # anyio_backend_name defined by:
    # https://anyio.readthedocs.io/en/stable/testing.html#specifying-the-backends-to-run-on
    return functools.partial(
        TestClient,
        backend=anyio_backend_name,
        backend_options=anyio_backend_options,
    )