File: conftest.py

package info (click to toggle)
pytrydan 0.8.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 436 kB
  • sloc: python: 690; makefile: 22; javascript: 8; sh: 5
file content (25 lines) | stat: -rw-r--r-- 572 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
from pathlib import Path
from typing import Any

import orjson

from pytrydan import Trydan


def _fixtures_dir() -> Path:
    return Path(__file__).parent / "fixtures"


def _load_fixture(name: str) -> str:
    with open(_fixtures_dir() / name) as read_in:
        return read_in.read()


def _load_json_fixture(case_endpoint: str) -> dict[str, Any]:
    return orjson.loads(_load_fixture(case_endpoint))


async def _get_mock_trydan(update: bool = True):  # type: ignore[no-untyped-def]
    """Return a mock Trydan."""
    trydan = Trydan("127.0.0.1")
    return trydan