File: conftest.py

package info (click to toggle)
python-aiohasupervisor 0.3.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 932 kB
  • sloc: python: 4,666; sh: 37; makefile: 3
file content (27 lines) | stat: -rw-r--r-- 735 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""Shared fixtures for aiohasupervisor tests."""

from collections.abc import AsyncGenerator, Generator

from aioresponses import aioresponses
import pytest

from aiohasupervisor import SupervisorClient

from .const import SUPERVISOR_URL


@pytest.fixture(name="supervisor_client")
async def client() -> AsyncGenerator[SupervisorClient, None]:
    """Return a Supervisor client."""
    async with SupervisorClient(
        SUPERVISOR_URL,
        "abc123",
    ) as supervisor_client:
        yield supervisor_client


@pytest.fixture(name="responses")
def aioresponses_fixture() -> Generator[aioresponses, None, None]:
    """Return aioresponses fixture."""
    with aioresponses() as mocked_responses:
        yield mocked_responses