File: conftest.py

package info (click to toggle)
python-rokuecp 0.19.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 664 kB
  • sloc: python: 2,193; xml: 547; makefile: 3
file content (16 lines) | stat: -rw-r--r-- 443 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""Setup pytest."""
from collections.abc import Generator
from unittest.mock import AsyncMock, Mock, patch

import pytest


@pytest.fixture(name="resolver")
def resolver_fixture() -> Generator[AsyncMock, None, None]:
    """Mock the threaded resolver."""
    resolver = AsyncMock(return_value=[])
    loop = Mock()
    loop.getaddrinfo = resolver

    with patch("rokuecp.resolver.get_running_loop", return_value=loop):
        yield resolver