Reduce scope of JSON/XML test fixtures (#126590)

pull/126595/head
Erik Montnemery 2024-09-24 08:29:35 +02:00 committed by GitHub
parent 4869309997
commit 3c9f51fbbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 12 deletions

View File

@ -32,13 +32,13 @@ class MockDoorbirdEntry:
api: MagicMock
@pytest.fixture(scope="session")
@pytest.fixture(scope="package")
def doorbird_info() -> dict[str, Any]:
"""Return a loaded DoorBird info fixture."""
return load_json_value_fixture("info.json", "doorbird")["BHA"]["VERSION"][0]
@pytest.fixture(scope="session")
@pytest.fixture(scope="package")
def doorbird_schedule() -> list[DoorBirdScheduleEntry]:
"""Return a loaded DoorBird schedule fixture."""
return DoorBirdScheduleEntry.parse_all(
@ -46,7 +46,7 @@ def doorbird_schedule() -> list[DoorBirdScheduleEntry]:
)
@pytest.fixture(scope="session")
@pytest.fixture(scope="package")
def doorbird_schedule_wrong_param() -> list[DoorBirdScheduleEntry]:
"""Return a loaded DoorBird schedule fixture with an incorrect param."""
return DoorBirdScheduleEntry.parse_all(
@ -54,7 +54,7 @@ def doorbird_schedule_wrong_param() -> list[DoorBirdScheduleEntry]:
)
@pytest.fixture(scope="session")
@pytest.fixture(scope="package")
def doorbird_favorites() -> dict[str, dict[str, Any]]:
"""Return a loaded DoorBird favorites fixture."""
return load_json_value_fixture("favorites.json", "doorbird")

View File

@ -40,13 +40,13 @@ def mock_geniushub_client() -> Generator[AsyncMock]:
yield client
@pytest.fixture(scope="session")
@pytest.fixture(scope="package")
def zones() -> list[dict[str, Any]]:
"""Return a list of zones."""
return load_json_array_fixture("zones_cloud_test_data.json", DOMAIN)
@pytest.fixture(scope="session")
@pytest.fixture(scope="package")
def devices() -> list[dict[str, Any]]:
"""Return a list of devices."""
return load_json_array_fixture("devices_cloud_test_data.json", DOMAIN)

View File

@ -46,37 +46,37 @@ def mock_ondilo_client(
yield client
@pytest.fixture(scope="session")
@pytest.fixture(scope="package")
def pool1() -> list[dict[str, Any]]:
"""First pool description."""
return [load_json_object_fixture("pool1.json", DOMAIN)]
@pytest.fixture(scope="session")
@pytest.fixture(scope="package")
def pool2() -> list[dict[str, Any]]:
"""Second pool description."""
return [load_json_object_fixture("pool2.json", DOMAIN)]
@pytest.fixture(scope="session")
@pytest.fixture(scope="package")
def ico_details1() -> dict[str, Any]:
"""ICO details of first pool."""
return load_json_object_fixture("ico_details1.json", DOMAIN)
@pytest.fixture(scope="session")
@pytest.fixture(scope="package")
def ico_details2() -> dict[str, Any]:
"""ICO details of second pool."""
return load_json_object_fixture("ico_details2.json", DOMAIN)
@pytest.fixture(scope="session")
@pytest.fixture(scope="package")
def last_measures() -> list[dict[str, Any]]:
"""Pool measurements."""
return load_json_array_fixture("last_measures.json", DOMAIN)
@pytest.fixture(scope="session")
@pytest.fixture(scope="package")
def two_pools(
pool1: list[dict[str, Any]], pool2: list[dict[str, Any]]
) -> list[dict[str, Any]]: