From 910eb1d5f41515eff05bd98b3b156062674a80bb Mon Sep 17 00:00:00 2001 From: Joe Date: Sat, 11 Jan 2025 17:05:30 -0500 Subject: [PATCH] Bump pybirdbuddy [fixes #89] (#90) * Bump pybirdbuddy [fixes #89] * Bump HA requirements * Bump test dependencies * Fix 3.11 dependencies, maybe? * Stop testing 3.11 * Update tests --- .github/workflows/pythonpackage.yaml | 2 +- custom_components/birdbuddy/manifest.json | 2 +- hacs.json | 2 +- requirements.test.txt | 22 ++++++++++++++-------- tests/test_device_trigger.py | 6 ++---- tests/test_init.py | 9 +++------ 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pythonpackage.yaml b/.github/workflows/pythonpackage.yaml index 460f889..a392c1e 100644 --- a/.github/workflows/pythonpackage.yaml +++ b/.github/workflows/pythonpackage.yaml @@ -11,7 +11,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ["3.11", "3.12"] + python-version: ["3.12"] steps: - uses: actions/checkout@v3 diff --git a/custom_components/birdbuddy/manifest.json b/custom_components/birdbuddy/manifest.json index 7ea6acf..341609a 100644 --- a/custom_components/birdbuddy/manifest.json +++ b/custom_components/birdbuddy/manifest.json @@ -16,7 +16,7 @@ ], "requirements": [ "python-graphql-client==0.4.3", - "pybirdbuddy==0.0.18" + "pybirdbuddy==0.0.19" ], "ssdp": [], "version": "0.0.21", diff --git a/hacs.json b/hacs.json index 77eaf14..7c7f642 100644 --- a/hacs.json +++ b/hacs.json @@ -2,5 +2,5 @@ "name": "Bird Buddy", "render_readme": true, "country": "US", - "homeassistant": "2023.7.0" + "homeassistant": "2024.4.0" } diff --git a/requirements.test.txt b/requirements.test.txt index c67e6e7..50ca4ce 100644 --- a/requirements.test.txt +++ b/requirements.test.txt @@ -5,11 +5,17 @@ python-graphql-client==0.4.3 -e git+https://github.com/jhansche/pybirdbuddy.git@main#egg=pybirdbuddy # for tests -coverage==7.2.4 -pytest==7.3.1 -pytest-cov==3.0.0 -pytest-aiohttp==1.0.4 -pytest-asyncio==0.20.3 -pytest-unordered==0.5.2 -py==1.10.0 # Fixes pytest-sugar 0.9.5 -pytest-homeassistant-custom-component==0.13.42 +# For Python 3.12 and above +pytest-homeassistant-custom-component==0.13.128; python_version >= '3.12' + +# For Python 3.11 +pytest-homeassistant-custom-component==0.13.42; python_version < '3.12' + +coverage +pytest +pytest-cov +pytest-aiohttp +pytest-asyncio +pytest-unordered +py +propcache diff --git a/tests/test_device_trigger.py b/tests/test_device_trigger.py index 08e7143..ad795e5 100644 --- a/tests/test_device_trigger.py +++ b/tests/test_device_trigger.py @@ -105,9 +105,8 @@ async def test_does_not_fire_on_postcard_event_for_other_feeder(hass, calls): async def test_config_schema(hass, device_reg): """Test we get the expected triggers from a birdbuddy.""" - config_entry = MockConfigEntry(domain="birdbuddy", data={}) + config_entry = MockConfigEntry(domain="birdbuddy", data={}, state=ConfigEntryState.LOADED) config_entry.add_to_hass(hass) - config_entry.state = ConfigEntryState.LOADED device_entry = device_reg.async_get_or_create( config_entry_id=config_entry.entry_id, identifiers={(DOMAIN, "feeder1")}, @@ -125,9 +124,8 @@ async def test_config_schema(hass, device_reg): async def test_config_schema_no_coordinator(hass, device_reg): """Test we get the expected triggers from a birdbuddy.""" - config_entry = MockConfigEntry(domain="birdbuddy", data={}) + config_entry = MockConfigEntry(domain="birdbuddy", data={}, state=ConfigEntryState.LOADED) config_entry.add_to_hass(hass) - config_entry.state = ConfigEntryState.LOADED device_entry = device_reg.async_get_or_create( config_entry_id=config_entry.entry_id, identifiers={(DOMAIN, "feeder1")}, diff --git a/tests/test_init.py b/tests/test_init.py index dbecc0a..b5928a0 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -21,9 +21,8 @@ async def test_setup_entry(hass: HomeAssistant): "email": "test@email.com", "password": "test-password", } - config_entry = MockConfigEntry(domain="birdbuddy", data=config) + config_entry = MockConfigEntry(domain="birdbuddy", data=config, state=ConfigEntryState.NOT_LOADED) config_entry.add_to_hass(hass) - config_entry.state = ConfigEntryState.NOT_LOADED with patch( "birdbuddy.client.BirdBuddy.refresh", @@ -44,9 +43,8 @@ async def test_setup_entry_no_feeders(hass: HomeAssistant): "email": "test@email.com", "password": "test-password", } - config_entry = MockConfigEntry(domain="birdbuddy", data=config) + config_entry = MockConfigEntry(domain="birdbuddy", data=config, state=ConfigEntryState.NOT_LOADED) config_entry.add_to_hass(hass) - config_entry.state = ConfigEntryState.NOT_LOADED with patch( "birdbuddy.client.BirdBuddy.refresh", @@ -64,9 +62,8 @@ async def test_setup_entry_refresh_fails(hass: HomeAssistant): "email": "test@email.com", "password": "test-password", } - config_entry = MockConfigEntry(domain="birdbuddy", data=config) + config_entry = MockConfigEntry(domain="birdbuddy", data=config, state=ConfigEntryState.NOT_LOADED) config_entry.add_to_hass(hass) - config_entry.state = ConfigEntryState.NOT_LOADED with patch( "birdbuddy.client.BirdBuddy.refresh",