From 3c9f51fbbd95de31890884d1e431fc882b49bb03 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Tue, 24 Sep 2024 08:29:35 +0200 Subject: [PATCH] Reduce scope of JSON/XML test fixtures (#126590) --- tests/components/doorbird/conftest.py | 8 ++++---- tests/components/geniushub/conftest.py | 4 ++-- tests/components/ondilo_ico/conftest.py | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/components/doorbird/conftest.py b/tests/components/doorbird/conftest.py index 2e367e4e1d8..0da69a98303 100644 --- a/tests/components/doorbird/conftest.py +++ b/tests/components/doorbird/conftest.py @@ -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") diff --git a/tests/components/geniushub/conftest.py b/tests/components/geniushub/conftest.py index 15938eabc62..1d2e706a6a6 100644 --- a/tests/components/geniushub/conftest.py +++ b/tests/components/geniushub/conftest.py @@ -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) diff --git a/tests/components/ondilo_ico/conftest.py b/tests/components/ondilo_ico/conftest.py index a847c1df069..d35e5ac0003 100644 --- a/tests/components/ondilo_ico/conftest.py +++ b/tests/components/ondilo_ico/conftest.py @@ -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]]: