File: conftest.py

package info (click to toggle)
python-aiopyarr 23.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,300 kB
  • sloc: python: 25,335; makefile: 22; javascript: 11
file content (62 lines) | stat: -rw-r--r-- 1,555 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""Tests configuration."""
# pylint:disable=redefined-outer-name
import asyncio

from aiohttp import ClientSession
import pytest_asyncio

from aiopyarr.lidarr_client import LidarrClient
from aiopyarr.radarr_client import RadarrClient
from aiopyarr.readarr_client import ReadarrClient
from aiopyarr.sonarr_client import SonarrClient

from tests import TEST_HOST_CONFIGURATION


@pytest_asyncio.fixture(autouse=True)
def loop_factory():
    """Create loop."""
    return asyncio.new_event_loop


@pytest_asyncio.fixture()
async def apisession():
    """Create client session."""
    async with ClientSession() as sess:
        yield sess


@pytest_asyncio.fixture()
async def lidarr_client(apisession):
    """Create Lidarr Client."""
    async with LidarrClient(
        session=apisession, host_configuration=TEST_HOST_CONFIGURATION
    ) as obj:
        yield obj


@pytest_asyncio.fixture()
async def radarr_client(apisession):
    """Create Radarr Client."""
    async with RadarrClient(
        session=apisession, host_configuration=TEST_HOST_CONFIGURATION
    ) as obj:
        yield obj


@pytest_asyncio.fixture()
async def readarr_client(apisession):
    """Create Readarr Client."""
    async with ReadarrClient(
        session=apisession, host_configuration=TEST_HOST_CONFIGURATION
    ) as obj:
        yield obj


@pytest_asyncio.fixture()
async def sonarr_client(apisession):
    """Create Sonarr Client."""
    async with SonarrClient(
        session=apisession, host_configuration=TEST_HOST_CONFIGURATION
    ) as obj:
        yield obj